summaryrefslogtreecommitdiff
path: root/lib/libc/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/amd64')
-rw-r--r--lib/libc/amd64/SYS.h31
-rw-r--r--lib/libc/amd64/gen/_setjmp.S7
-rw-r--r--lib/libc/amd64/gen/setjmp.S18
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S21
-rw-r--r--lib/libc/amd64/sys/setlogin.S2
-rw-r--r--lib/libc/amd64/sys/vfork.S11
6 files changed, 30 insertions, 60 deletions
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
index cadbecb1b31a..2d585628107c 100644
--- a/lib/libc/amd64/SYS.h
+++ b/lib/libc/amd64/SYS.h
@@ -61,31 +61,28 @@
* Design note:
*
* The macros PSYSCALL() and PRSYSCALL() are intended for use where a
- * syscall needs to be renamed in the threaded library. When building
- * a normal library, they default to the traditional SYSCALL() and
- * RSYSCALL(). This avoids the need to #ifdef _THREAD_SAFE everywhere
- * that the renamed function needs to be called.
+ * syscall needs to be renamed in the threaded library.
*/
-#ifdef _THREAD_SAFE
/*
- * For the thread_safe versions, we prepend _thread_sys_ to the function
+ * For the thread_safe versions, we prepend __sys_ to the function
* name so that the 'C' wrapper can go around the real name.
*/
#define PSYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
- ENTRY(__CONCAT(_thread_sys_,x)); \
+ ENTRY(__CONCAT(__sys_,x)); \
+ .weak CNAME(x); \
+ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(_,x)); \
+ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
+
#define PRSYSCALL(x) PSYSCALL(x); ret
-#define PPSEUDO(x,y) ENTRY(__CONCAT(_thread_sys_,x)); \
+
+#define PPSEUDO(x,y) ENTRY(__CONCAT(__sys_,x)); \
+ .weak CNAME(x); \
+ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \
+ .weak CNAME(__CONCAT(_,x)); \
+ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
-#else
-/*
- * The non-threaded library defaults to traditional syscalls where
- * the function name matches the syscall name.
- */
-#define PSYSCALL(x) SYSCALL(x)
-#define PRSYSCALL(x) RSYSCALL(x)
-#define PPSEUDO(x,y) PSEUDO(x,y)
-#endif
#ifdef __ELF__
#define KERNCALL int $0x80 /* Faster */
diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S
index 9c66308dc502..5932feeee0c5 100644
--- a/lib/libc/amd64/gen/_setjmp.S
+++ b/lib/libc/amd64/gen/_setjmp.S
@@ -66,12 +66,9 @@ ENTRY(_setjmp)
xorl %eax,%eax
ret
-#ifdef _THREAD_SAFE
+ .weak CNAME(_longjmp)
+ .set CNAME(_longjmp),CNAME(___longjmp)
ENTRY(___longjmp)
-#else
-ALTENTRY(___longjmp)
-ENTRY(_longjmp)
-#endif
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index 738407a1a8f2..5e92c979a7dc 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -61,11 +61,7 @@ ENTRY(setjmp)
pushl %eax /* (sigset_t*)oset */
pushl $0 /* (sigset_t*)set */
pushl $1 /* SIG_BLOCK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
+ call PIC_PLT(CNAME(_sigprocmask))
addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%ecx
@@ -80,10 +76,8 @@ ENTRY(setjmp)
xorl %eax,%eax
ret
-#ifndef _THREAD_SAFE
-.weak CNAME(longjmp);
-.set CNAME(longjmp),CNAME(__longjmp);
-#endif
+ .weak CNAME(longjmp)
+ .set CNAME(longjmp),CNAME(__longjmp)
ENTRY(__longjmp)
movl 4(%esp),%edx
PIC_PROLOGUE
@@ -91,11 +85,7 @@ ENTRY(__longjmp)
leal 28(%edx), %eax
pushl %eax /* (sigset_t*)set */
pushl $3 /* SIG_SETMASK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
+ call PIC_PLT(CNAME(_sigprocmask))
addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%edx
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 40aebb65e53f..96aae6897034 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -52,9 +52,6 @@
* the renamed functions (introduced in gcc-2.5.3; previous versions
* only supported *jmp with 0 or 1 leading underscores).
*
- * Use sigprocmask() instead of sigblock() and sigsetmask(), and
- * check for and handle errors.
- *
* Restore _all_ the registers and the signal mask atomically. Can
* use sigreturn() if sigreturn() works.
*/
@@ -70,11 +67,7 @@ ENTRY(sigsetjmp)
pushl %eax /* (sigset_t*)oset */
pushl $0 /* (sigset_t*)set */
pushl $1 /* SIG_BLOCK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
+ call PIC_PLT(CNAME(_sigprocmask))
addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%ecx
@@ -89,10 +82,8 @@ ENTRY(sigsetjmp)
xorl %eax,%eax
ret
-#ifndef _THREAD_SAFE
-.weak CNAME(siglongjmp);
-.set CNAME(siglongjmp),CNAME(__siglongjmp);
-#endif
+ .weak CNAME(siglongjmp);
+ .set CNAME(siglongjmp),CNAME(__siglongjmp);
ENTRY(__siglongjmp);
movl 4(%esp),%edx
cmpl $0,44(%edx)
@@ -102,11 +93,7 @@ ENTRY(__siglongjmp);
leal 28(%edx), %eax
pushl %eax /* (sigset_t*)set */
pushl $3 /* SIG_SETMASK */
-#ifdef _THREAD_SAFE
- call PIC_PLT(CNAME(_thread_sys_sigprocmask))
-#else
- call PIC_PLT(CNAME(sigprocmask))
-#endif
+ call PIC_PLT(CNAME(_sigprocmask))
addl $12,%esp
PIC_EPILOGUE
movl 4(%esp),%edx
diff --git a/lib/libc/amd64/sys/setlogin.S b/lib/libc/amd64/sys/setlogin.S
index a4d74b0d10cf..3ba52c5cde38 100644
--- a/lib/libc/amd64/sys/setlogin.S
+++ b/lib/libc/amd64/sys/setlogin.S
@@ -43,7 +43,7 @@
#include "SYS.h"
-.globl CNAME(_logname_valid) /* in getlogin() */
+.globl CNAME(_logname_valid) /* in _getlogin() */
SYSCALL(setlogin)
#ifdef PIC
diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S
index 8ec99aeaad21..8981308dbdb3 100644
--- a/lib/libc/amd64/sys/vfork.S
+++ b/lib/libc/amd64/sys/vfork.S
@@ -51,12 +51,11 @@
* %eax == pid of child in parent, %eax == pid of parent in child.
*
*/
-
-#ifdef _THREAD_SAFE
-ENTRY(_thread_sys_vfork)
-#else
-ENTRY(vfork)
-#endif
+ .weak _vfork
+ .set _vfork,__sys_vfork
+ .weak vfork
+ .set vfork,__sys_vfork
+ENTRY(__sys_vfork)
popl %ecx /* my rta into ecx */
lea SYS_vfork,%eax
KERNCALL