[Glibc-bsd-commits] r5781 - in trunk/glibc-ports: fbtl/sysdeps/i386 fbtl/sysdeps/x86_64 kfreebsd/fbtl kfreebsd/i386 kfreebsd/i386/fbtl kfreebsd/x86_64 kfreebsd/x86_64/fbtl
aurel32 at alioth.debian.org
aurel32 at alioth.debian.org
Tue Oct 20 10:10:28 UTC 2015
Author: aurel32
Date: 2015-10-20 10:10:28 +0000 (Tue, 20 Oct 2015)
New Revision: 5781
Added:
trunk/glibc-ports/kfreebsd/i386/exit-thread.h
trunk/glibc-ports/kfreebsd/x86_64/exit-thread.h
Removed:
trunk/glibc-ports/kfreebsd/i386/fbtl/exit-thread.S
trunk/glibc-ports/kfreebsd/x86_64/fbtl/exit-thread.S
Modified:
trunk/glibc-ports/fbtl/sysdeps/i386/pthreaddef.h
trunk/glibc-ports/fbtl/sysdeps/x86_64/pthreaddef.h
trunk/glibc-ports/kfreebsd/fbtl/Makefile
Log:
kfreebsd changes corresponding to upstream commit e0db6517 (Clean up __exit_thread.)
Modified: trunk/glibc-ports/fbtl/sysdeps/i386/pthreaddef.h
===================================================================
--- trunk/glibc-ports/fbtl/sysdeps/i386/pthreaddef.h 2015-10-19 22:14:19 UTC (rev 5780)
+++ trunk/glibc-ports/fbtl/sysdeps/i386/pthreaddef.h 2015-10-20 10:10:28 UTC (rev 5781)
@@ -38,16 +38,3 @@
/* Location of current stack frame. */
#define CURRENT_STACK_FRAME __builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here. */
-
-/* While there is no such syscall. */
-#define __exit_thread_inline(val) \
- while (1) { \
- if (__builtin_constant_p (val) && (val) == 0) \
- asm volatile ("xorl %%ebx, %%ebx; int $0x80" :: "a" (__NR_exit)); \
- else \
- asm volatile ("movl %1, %%ebx; int $0x80" \
- :: "a" (__NR_exit), "r" (val)); \
- }
Modified: trunk/glibc-ports/fbtl/sysdeps/x86_64/pthreaddef.h
===================================================================
--- trunk/glibc-ports/fbtl/sysdeps/x86_64/pthreaddef.h 2015-10-19 22:14:19 UTC (rev 5780)
+++ trunk/glibc-ports/fbtl/sysdeps/x86_64/pthreaddef.h 2015-10-20 10:10:28 UTC (rev 5781)
@@ -42,10 +42,3 @@
/* Location of current stack frame. The frame pointer is not usable. */
#define CURRENT_STACK_FRAME \
({ register char *frame __asm__("rsp"); frame; })
-
-
-/* XXX Until we have a better place keep the definitions here. */
-
-/* While there is no such syscall. */
-#define __exit_thread_inline(val) \
- asm volatile ("syscall" :: "a" (__NR_exit), "D" (val))
Modified: trunk/glibc-ports/kfreebsd/fbtl/Makefile
===================================================================
--- trunk/glibc-ports/kfreebsd/fbtl/Makefile 2015-10-19 22:14:19 UTC (rev 5780)
+++ trunk/glibc-ports/kfreebsd/fbtl/Makefile 2015-10-20 10:10:28 UTC (rev 5781)
@@ -43,7 +43,6 @@
libpthread-routines += ptw-sys_thr_self
libpthread-routines += ptw-sys_thr_set_name
libpthread-routines += ptw-sys_thr_exit
-libpthread-routines += ptw-exit-thread
libpthread-routines += ptw-sigprocmask
libpthread-routines += ptw-ioctl
libpthread-routines += ptw-sys_clock_getcpuclockid2
@@ -59,9 +58,5 @@
CFLAGS-getpid.os = -fomit-frame-pointer
endif
-ifeq ($(subdir),posix)
-sysdep_routines += exit-thread
-endif
-
# Needed in both the signal and nptl subdir.
CFLAGS-sigaction.c = -DWRAPPER_INCLUDE='<fbtl/sigaction.c>'
Added: trunk/glibc-ports/kfreebsd/i386/exit-thread.h
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/exit-thread.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/i386/exit-thread.h 2015-10-20 10:10:28 UTC (rev 5781)
@@ -0,0 +1,49 @@
+/* Call to terminate the current thread. GNU/kFreeBSD i386 version
+ Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+/* This causes the current thread to exit, without affecting other
+ threads in the process if there are any. If there are no other
+ threads left, then this has the effect of _exit (0). */
+
+static inline void __attribute__ ((noreturn, always_inline, unused))
+__exit_thread (void)
+{
+ /* Doing this in a loop is mostly just to satisfy the compiler that the
+ function really qualifies as noreturn. It also means that in some
+ pathological situation where the system call does not get made or does
+ not work, the thread will simply spin rather than running off the end
+ of the caller and doing unexpectedly strange things. */
+ while (1)
+ {
+ asm volatile (
+ "movl %%gs:0, %%edx\n\t"
+ "addl %0, %%edx\n\t" /* should be KTID, but they are at the same place anyway */
+ "movl %%edx, 4(%%esp)\n\t"
+ "movl %1, %%eax\n\t"
+ "int $0x80\n\t"
+ /* It does return only for last thread of process */
+ "movl %2, %%eax\n\t"
+ "movl $0, 4(%%esp)\n\t"
+ "int $0x80\n\t"
+ :
+ : "i" (TID), "i" (SYS_ify(thr_exit)), "i" (SYS_ify(exit))
+ : "memory", "cc");
+ }
+}
Deleted: trunk/glibc-ports/kfreebsd/i386/fbtl/exit-thread.S
===================================================================
--- trunk/glibc-ports/kfreebsd/i386/fbtl/exit-thread.S 2015-10-19 22:14:19 UTC (rev 5780)
+++ trunk/glibc-ports/kfreebsd/i386/fbtl/exit-thread.S 2015-10-20 10:10:28 UTC (rev 5781)
@@ -1,33 +0,0 @@
-/* Copyright (C) 2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
- .text
-ENTRY (__exit_thread)
- mov %gs:0, %edx
- mov 4(%esp), %ecx /* we will need it later,
- %ecx is saved by kernel */
- add $TID, %edx /* should be KTID, but
- they are at the same place anyway */
- mov %edx, 4(%esp)
- DO_CALL (thr_exit, 1)
- /* It does return only for last thread of process */
- mov %ecx, 4(%esp) /* use saved value */
- DO_CALL (exit, 1)
- /* Shouldn't get here. */
- hlt
-END (__exit_thread)
Added: trunk/glibc-ports/kfreebsd/x86_64/exit-thread.h
===================================================================
--- trunk/glibc-ports/kfreebsd/x86_64/exit-thread.h (rev 0)
+++ trunk/glibc-ports/kfreebsd/x86_64/exit-thread.h 2015-10-20 10:10:28 UTC (rev 5781)
@@ -0,0 +1,49 @@
+/* Call to terminate the current thread. GNU/kFreeBSD x86-64 version
+ Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+/* This causes the current thread to exit, without affecting other
+ threads in the process if there are any. If there are no other
+ threads left, then this has the effect of _exit (0). */
+
+static inline void __attribute__ ((noreturn, always_inline, unused))
+__exit_thread (void)
+{
+ /* Doing this in a loop is mostly just to satisfy the compiler that the
+ function really qualifies as noreturn. It also means that in some
+ pathological situation where the system call does not get made or does
+ not work, the thread will simply spin rather than running off the end
+ of the caller and doing unexpectedly strange things. */
+ while (1)
+ {
+ asm volatile (
+ "movq %%fs:0, %%rdi\n\t"
+ "addq %0, %%rdi\n\t" /* should be KTID, but they are at the same place anyway */
+ "movl %1, %%eax\n\t"
+ "syscall\n\t"
+ /* It does return only for last thread of process */
+ "movl %2, %%eax\n\t"
+ "xorl %%edi, %%edi\n\t"
+ "syscall\n\t"
+ :
+ : "i" (TID), "i" (SYS_ify(thr_exit)), "i" (SYS_ify(exit))
+ : "memory", "cc", "cx", "dx", "r8", "r9", "r10", "r11");
+ }
+}
+
Deleted: trunk/glibc-ports/kfreebsd/x86_64/fbtl/exit-thread.S
===================================================================
--- trunk/glibc-ports/kfreebsd/x86_64/fbtl/exit-thread.S 2015-10-19 22:14:19 UTC (rev 5780)
+++ trunk/glibc-ports/kfreebsd/x86_64/fbtl/exit-thread.S 2015-10-20 10:10:28 UTC (rev 5781)
@@ -1,33 +0,0 @@
-/* Copyright (C) 2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
- .text
-ENTRY (__exit_thread)
- movq %rdi, %rsi /* we will need it later,
- %rsi is saved by kernel */
- mov %fs:0, %rdi
- addq $TID, %rdi /* should be KTID, but
- they are at the same place anyway */
- DO_CALL (thr_exit, 1)
- /* It does return only for last thread of process */
- movq %rsi, %rdi /* use saved value */
- DO_CALL (exit, 1)
- /* Shouldn't get here. */
- hlt
-END (__exit_thread)
More information about the Glibc-bsd-commits
mailing list