aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/amd64/SYS.h33
-rw-r--r--lib/libc/amd64/gen/setjmp.S16
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S16
-rw-r--r--lib/libc/amd64/sys/brk.S33
-rw-r--r--lib/libc/amd64/sys/cerror.S27
-rw-r--r--lib/libc/amd64/sys/exect.S9
-rw-r--r--lib/libc/amd64/sys/pipe.S10
-rw-r--r--lib/libc/amd64/sys/ptrace.S13
-rw-r--r--lib/libc/amd64/sys/sbrk.S39
-rw-r--r--lib/libc/amd64/sys/setlogin.S10
-rw-r--r--lib/libc/amd64/sys/sigreturn.S19
-rw-r--r--lib/libc/amd64/sys/vfork.S28
-rw-r--r--lib/libc/gmon/gmon.c4
-rw-r--r--lib/libc/i386/DEFS.h38
-rw-r--r--lib/libc/i386/SYS.h33
-rw-r--r--lib/libc/i386/gen/modf.S12
-rw-r--r--lib/libc/i386/gen/setjmp.S16
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S16
-rw-r--r--lib/libc/i386/sys/Ovfork.S28
-rw-r--r--lib/libc/i386/sys/brk.S33
-rw-r--r--lib/libc/i386/sys/cerror.S27
-rw-r--r--lib/libc/i386/sys/exect.S9
-rw-r--r--lib/libc/i386/sys/fork.S10
-rw-r--r--lib/libc/i386/sys/pipe.S10
-rw-r--r--lib/libc/i386/sys/ptrace.S13
-rw-r--r--lib/libc/i386/sys/rfork.S10
-rw-r--r--lib/libc/i386/sys/sbrk.S39
-rw-r--r--lib/libc/i386/sys/setlogin.S10
-rw-r--r--lib/libc/i386/sys/sigpending.S10
-rw-r--r--lib/libc/i386/sys/sigprocmask.S11
-rw-r--r--lib/libc/i386/sys/sigreturn.S19
-rw-r--r--lib/libc/i386/sys/sigsuspend.S11
-rw-r--r--lib/libc/i386/sys/syscall.S9
33 files changed, 340 insertions, 281 deletions
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
index 9e989e5116af..caea98ff9e23 100644
--- a/lib/libc/amd64/SYS.h
+++ b/lib/libc/amd64/SYS.h
@@ -35,7 +35,7 @@
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
*
- * $Id: SYS.h,v 1.2 1994/08/05 01:17:57 wollman Exp $
+ * $Id: SYS.h,v 1.3 1996/01/22 00:00:51 julian Exp $
*/
#include <sys/syscall.h>
@@ -61,28 +61,27 @@
#define PIC_GOTOFF(x) x
#endif
-#define SYSCALL(x) 2: jmp cerror; ENTRY(x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
+#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(x); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
#define RSYSCALL(x) SYSCALL(x); ret
-#ifdef _THREAD_SAFE
/*
- * Support for user-space threads which require that some syscalls be
- * private to the threaded library.
+ * For the thread_safe versions, we prepend _thread_sys_ to the function
+ * name so that the 'C' wrapper can go around the real name.
*/
-#define PSYSCALL(x) 2: jmp cerror; ENTRY(_thread_sys_/**/x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
-#else
-/*
- * The non-threaded library defaults to traditional syscalls where
- * the function name matches the syscall name.
- */
-#define PSYSCALL(x) SYSCALL(x)
+#ifdef _THREAD_SAFE /* in case */
+#define PSYSCALL(x,y) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(y); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
+#define PRSYSCALL(x,y) PSYSCALL(x,y); ret
#endif
-#define PRSYSCALL(x) PSYSCALL(x); ret
-#define PSEUDO(x,y) ENTRY(x); lea SYS_/**/y, %eax; ; LCALL(7,0); ret
-#define CALL(x,y) call _/**/y; addl $4*x,%esp
+
+#define PSEUDO(x,y) ENTRY(x); lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
+#define CALL(x,y) call CNAME(y); addl $4*x,%esp
/* gas fucks up offset -- although we don't currently need it, do for BCS */
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
-#define ASMSTR .asciz
+#ifdef __ELF__
+#define KERNCALL int $0x80 /* Faster */
+#else
+#define KERNCALL LCALL(7,0) /* The old way */
+#endif
- .globl cerror
+#define ASMSTR .asciz
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index 89efa92ccf85..078b2ebc089e 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $
+ * $Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $"
+ .asciz "$Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $"
#endif /* LIBC_RCS and not lint */
/*
@@ -59,13 +59,15 @@ ENTRY(_thread_sys_setjmp)
#else
ENTRY(setjmp)
#endif
+ PIC_PROLOGUE
pushl $0
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigblock)
+ call PIC_PLT(CNAME(_thread_sys_sigblock))
#else
- call PIC_PLT(_sigblock)
+ call PIC_PLT(CNAME(sigblock))
#endif
popl %edx
+ PIC_EPILOGUE
movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
@@ -85,13 +87,15 @@ ENTRY(_thread_sys_longjmp)
ENTRY(longjmp)
#endif
movl 4(%esp),%edx
+ PIC_PROLOGUE
pushl 24(%edx)
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigsetmask)
+ call PIC_PLT(CNAME(_thread_sys_sigsetmask))
#else
- call PIC_PLT(_sigsetmask) /* XXX this is not reentrant */
+ call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */
#endif
popl %eax
+ PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 5cc00f054323..1d56f290980f 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $
+ * $Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $"
+ .asciz "$Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -69,13 +69,15 @@ ENTRY(sigsetjmp)
movl %eax,32(%ecx)
testl %eax,%eax
jz 1f
+ PIC_PROLOGUE
pushl $0
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigblock)
+ call PIC_PLT(CNAME(_thread_sys_sigblock))
#else
- call PIC_PLT(_sigblock)
+ call PIC_PLT(CNAME(sigblock))
#endif
addl $4,%esp
+ PIC_EPILOGUE
movl 4(%esp),%ecx
movl %eax,24(%ecx)
1: movl 0(%esp),%edx
@@ -97,13 +99,15 @@ ENTRY(siglongjmp)
movl 4(%esp),%edx
cmpl $0,32(%edx)
jz 1f
+ PIC_PROLOGUE
pushl 24(%edx)
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigsetmask)
+ call PIC_PLT(CNAME(_thread_sys_sigsetmask))
#else
- call PIC_PLT(_sigsetmask)
+ call PIC_PLT(CNAME(sigsetmask))
#endif
addl $4,%esp
+ PIC_EPILOGUE
1: movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/amd64/sys/brk.S b/lib/libc/amd64/sys/brk.S
index c8311bbf9723..1636858c0d3e 100644
--- a/lib/libc/amd64/sys/brk.S
+++ b/lib/libc/amd64/sys/brk.S
@@ -33,20 +33,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: brk.S,v 1.1 1994/08/05 01:18:39 wollman Exp $
+ * $Id: brk.S,v 1.2 1995/01/23 01:29:39 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: brk.S,v 1.2 1995/01/23 01:29:39 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-#define SYS_brk 17
-
- .globl curbrk
- .globl minbrk
+ .globl HIDENAME(curbrk)
+ .globl HIDENAME(minbrk)
ENTRY(_brk)
jmp ok
@@ -54,39 +52,40 @@ ENTRY(brk)
#ifdef PIC
movl 4(%esp),%eax
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx # set up GOT addressing
- movl PIC_GOT(minbrk),%ecx #
+ movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing
+ movl PIC_GOT(HIDENAME(minbrk)),%ecx #
cmpl %eax,(%ecx)
PIC_EPILOGUE
jl ok
movl (%ecx),%eax
movl %eax,4(%esp)
ok:
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
movl 4(%esp),%eax
movl %eax,(%edx)
movl $0,%eax
ret
err:
- jmp PIC_PLT(cerror)
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#else
movl 4(%esp),%eax
- cmpl %eax,minbrk
+ cmpl %eax,HIDENAME(minbrk)
jl ok
- movl minbrk,%eax
+ movl HIDENAME(minbrk),%eax
movl %eax,4(%esp)
ok:
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
movl 4(%esp),%eax
- movl %eax,curbrk
+ movl %eax,HIDENAME(curbrk)
movl $0,%eax
ret
err:
- jmp cerror
+ jmp HIDENAME(cerror)
#endif
diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S
index 2cbb0f94ab5b..926dcd9fff0d 100644
--- a/lib/libc/amd64/sys/cerror.S
+++ b/lib/libc/amd64/sys/cerror.S
@@ -33,28 +33,31 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $
+ * $Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $"
+ .asciz "$Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
+ .globl HIDENAME(cerror)
+
#ifdef _THREAD_SAFE
/*
* Threaded version using __error().
*/
- .globl ___error
- .type ___error,@function
-cerror:
+ .globl CNAME(__error)
+ .type CNAME(__error),@function
+HIDENAME(cerror):
pushl %eax
#ifdef PIC
- call PIC_PLT(___error)
+ /* The caller must execute the PIC prologue before jumping to cerror. */
+ call PIC_PLT(CNAME(__error))
#else
- call ___error
+ call CNAME(__error)
#endif
popl %ecx
movl %ecx,(%eax)
@@ -66,15 +69,15 @@ cerror:
/*
* Non-threaded version using global errno.
*/
- .globl _errno
-cerror:
+ .globl CNAME(errno)
+HIDENAME(cerror):
#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(_errno),%ecx
+ /* The caller must execute the PIC prologue before jumping to cerror. */
+ movl PIC_GOT(CNAME(errno)),%ecx
movl %eax,(%ecx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
movl $-1,%eax
movl $-1,%edx
diff --git a/lib/libc/amd64/sys/exect.S b/lib/libc/amd64/sys/exect.S
index 74a055bd5d28..59ce389f2978 100644
--- a/lib/libc/amd64/sys/exect.S
+++ b/lib/libc/amd64/sys/exect.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exect.S,v 1.1 1994/08/05 01:18:42 wollman Exp $
+ * $Id: exect.S,v 1.2 1995/01/23 01:29:46 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: exect.S,v 1.2 1995/01/23 01:29:46 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -51,5 +51,6 @@ ENTRY(exect)
orl $ PSL_T,%edx
pushl %edx
popf
- LCALL(7,0)
- jmp cerror /* exect(file, argv, env); */
+ KERNCALL
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */
diff --git a/lib/libc/amd64/sys/pipe.S b/lib/libc/amd64/sys/pipe.S
index 809445f0bec7..0dcf8572096b 100644
--- a/lib/libc/amd64/sys/pipe.S
+++ b/lib/libc/amd64/sys/pipe.S
@@ -33,17 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $
+ * $Id: pipe.S,v 1.3 1996/01/22 00:00:58 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $"
+ .asciz "$Id: pipe.S,v 1.3 1996/01/22 00:00:58 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-PSYSCALL(pipe)
+#ifdef _THREAD_SAFE
+PSYSCALL(pipe,_thread_sys_pipe)
+#else
+SYSCALL(pipe)
+#endif
movl 4(%esp),%ecx
movl %eax,(%ecx)
movl %edx,4(%ecx)
diff --git a/lib/libc/amd64/sys/ptrace.S b/lib/libc/amd64/sys/ptrace.S
index e3ac3a5b667c..993c9be55056 100644
--- a/lib/libc/amd64/sys/ptrace.S
+++ b/lib/libc/amd64/sys/ptrace.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ptrace.S,v 1.1 1994/08/05 01:18:47 wollman Exp $
+ * $Id: ptrace.S,v 1.2 1995/01/23 01:29:59 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: ptrace.S,v 1.2 1995/01/23 01:29:59 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -47,15 +47,16 @@ ENTRY(ptrace)
xorl %eax,%eax
#ifdef PIC
PIC_PROLOGUE
- movl PIC_GOT(_errno),%edx
+ movl PIC_GOT(CNAME(errno)),%edx
movl %eax,(%edx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
lea SYS_ptrace,%eax
- LCALL(7,0)
+ KERNCALL
jb err
ret
err:
- jmp cerror
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
diff --git a/lib/libc/amd64/sys/sbrk.S b/lib/libc/amd64/sys/sbrk.S
index 2d65b59dbb16..d5c48ddcb724 100644
--- a/lib/libc/amd64/sys/sbrk.S
+++ b/lib/libc/amd64/sys/sbrk.S
@@ -33,64 +33,63 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $
+ * $Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $"
+ .asciz "$Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-#define SYS_brk 17
-
- .globl _end
- .globl minbrk
- .globl curbrk
+ .globl CNAME(end)
+ .globl HIDENAME(minbrk)
+ .globl HIDENAME(curbrk)
.data
-minbrk: .long _end
-curbrk: .long _end
+HIDENAME(minbrk): .long CNAME(end)
+HIDENAME(curbrk): .long CNAME(end)
.text
ENTRY(sbrk)
#ifdef PIC
movl 4(%esp),%ecx
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
+ movl PIC_GOT(HIDENAME(curbrk)),%edx
movl (%edx),%eax
PIC_EPILOGUE
testl %ecx,%ecx
jz back
addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
+ movl PIC_GOT(HIDENAME(curbrk)),%edx
movl (%edx),%eax
addl %ecx,(%edx)
PIC_EPILOGUE
back:
ret
err:
- jmp PIC_PLT(cerror)
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#else /* !PIC */
movl 4(%esp),%ecx
- movl curbrk,%eax
+ movl HIDENAME(curbrk),%eax
testl %ecx,%ecx
jz back
addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
- movl curbrk,%eax
- addl %ecx,curbrk
+ movl HIDENAME(curbrk),%eax
+ addl %ecx,HIDENAME(curbrk)
back:
ret
err:
- jmp cerror
+ jmp HIDENAME(cerror)
#endif /* PIC */
diff --git a/lib/libc/amd64/sys/setlogin.S b/lib/libc/amd64/sys/setlogin.S
index 96c7886ec808..1ec31b9ef760 100644
--- a/lib/libc/amd64/sys/setlogin.S
+++ b/lib/libc/amd64/sys/setlogin.S
@@ -33,27 +33,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: setlogin.S,v 1.1 1994/08/05 01:18:50 wollman Exp $
+ * $Id: setlogin.S,v 1.2 1995/01/23 01:30:06 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: setlogin.S,v 1.2 1995/01/23 01:30:06 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "SYS.h"
-.globl __logname_valid /* in getlogin() */
+.globl CNAME(_logname_valid) /* in getlogin() */
SYSCALL(setlogin)
#ifdef PIC
PIC_PROLOGUE
pushl %eax
- movl PIC_GOT(__logname_valid),%eax
+ movl PIC_GOT(CNAME(_logname_valid)),%eax
movl $0,(%eax)
popl %eax
PIC_EPILOGUE
#else
- movl $0,__logname_valid
+ movl $0,CNAME(_logname_valid)
#endif
ret /* setlogin(name) */
diff --git a/lib/libc/amd64/sys/sigreturn.S b/lib/libc/amd64/sys/sigreturn.S
index 6f3f571c616e..cce518b742c3 100644
--- a/lib/libc/amd64/sys/sigreturn.S
+++ b/lib/libc/amd64/sys/sigreturn.S
@@ -33,25 +33,24 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $
+ * $Id: sigreturn.S,v 1.3 1996/01/22 00:01:00 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $"
+ .asciz "$Id: sigreturn.S,v 1.3 1996/01/22 00:01:00 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
/*
- * We must preserve the state of the registers as the user has set them up.
+ * NOTE: If the profiling ENTRY() code ever changes any registers, they
+ * must be saved. On FreeBSD, this is not the case.
*/
-#ifdef PROF
-#undef ENTRY
-#define ENTRY(x) \
- .globl _/**/x; .align 2; _/**/x: pusha ; \
- .data; 1:; .long 0; .text; movl $1b,%eax; call mcount; popa ; nop
-#endif /* PROF */
-PSYSCALL(sigreturn)
+#ifdef _THREAD_SAFE
+PSYSCALL(sigreturn,_thread_sys_sigreturn)
+#else
+SYSCALL(sigreturn)
+#endif
ret
diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S
index 341b75c97381..2b69ca0c16d4 100644
--- a/lib/libc/amd64/sys/vfork.S
+++ b/lib/libc/amd64/sys/vfork.S
@@ -33,14 +33,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $
+ * $Id: Ovfork.S,v 1.3 1996/01/22 00:00:56 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $"
+ .asciz "$Id: Ovfork.S,v 1.3 1996/01/22 00:00:56 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
+#include "DEFS.h"
#include "SYS.h"
/*
@@ -50,14 +51,11 @@
* %eax == pid of child in parent, %eax == pid of parent in child.
*
*/
- .set vfork,66
-.globl _vfork
-.type _vfork,@function
-_vfork:
+ENTRY(vfork)
popl %ecx /* my rta into ecx */
- movl $vfork, %eax
- LCALL(7,0)
+ lea SYS_vfork,%eax
+ KERNCALL
jb verror
vforkok:
cmpl $0,%edx /* child process? */
@@ -67,14 +65,14 @@ vforkok:
/*
* Threaded version using __error().
*/
- .globl ___error
- .type ___error,@function
+ .globl CNAME(__error)
+ .type CNAME(__error),@function
verror:
pushl %eax
#ifdef PIC
- call PIC_PLT(___error)
+ call PIC_PLT(CNAME(__error))
#else
- call ___error
+ call CNAME(__error)
#endif
popl %ecx
movl %ecx,(%eax)
@@ -84,15 +82,15 @@ verror:
/*
* Non-threaded version using global errno.
*/
- .globl _errno
+ .globl CNAME(errno)
verror:
#ifdef PIC
PIC_PROLOGUE
- movl PIC_GOT(_errno), %edx
+ movl PIC_GOT(CNAME(errno)), %edx
movl %eax,(%edx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
movl $-1,%eax
#endif /* !_THREAD_SAFE */
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index 572b7eb97e1c..81e36dd19cd6 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -44,7 +44,11 @@ static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93";
#include <fcntl.h>
#include <unistd.h>
+#if defined(__ELF__)
+extern char *minbrk asm (".minbrk");
+#else
extern char *minbrk asm ("minbrk");
+#endif
struct gmonparam _gmonparam = { GMON_PROF_OFF };
diff --git a/lib/libc/i386/DEFS.h b/lib/libc/i386/DEFS.h
index 6df18a13def7..2ec3019f91cd 100644
--- a/lib/libc/i386/DEFS.h
+++ b/lib/libc/i386/DEFS.h
@@ -35,9 +35,27 @@
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
*
- * $Id: DEFS.h,v 1.4 1994/05/03 16:29:13 jkh Exp $
+ * $Id: DEFS.h,v 1.2 1994/08/05 01:17:56 wollman Exp $
*/
+#include <sys/cdefs.h>
+
+/*
+ * CNAME and HIDENAME manage the relationship between symbol names in C
+ * and the equivalent assembly language names. CNAME is given a name as
+ * it would be used in a C program. It expands to the equivalent assembly
+ * language name. HIDENAME is given an assembly-language name, and expands
+ * to a possibly-modified form that will be invisible to C programs.
+ */
+#if defined(__ELF__) /* { */
+#define CNAME(csym) csym
+#define HIDENAME(asmsym) __CONCAT(.,asmsym)
+#else /* } { */
+#define CNAME(csym) __CONCAT(_,csym)
+#define HIDENAME(asmsym) asmsym
+#endif /* } */
+
+
/* XXX should use align 4,0x90 for -m486. */
#define _START_ENTRY .align 2,0x90;
#if 0
@@ -51,30 +69,30 @@
#ifdef PROF
#define ALTENTRY(x) _START_ENTRY \
- .globl _/**/x; .type _/**/x,@function; _/**/x:; \
+ .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
_MID_ENTRY \
- call mcount; jmp 9f
+ call HIDENAME(mcount); jmp 9f
-#define ENTRY(x) _START_ENTRY \
- .globl _/**/x; .type _/**/x,@function; _/**/x:; \
+#define ENTRY(x) _START_ENTRY \
+ .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
_MID_ENTRY \
- call mcount; 9:
+ call HIDENAME(mcount); 9:
#define ALTASENTRY(x) _START_ENTRY \
.globl x; .type x,@function; x:; \
_MID_ENTRY \
- call mcount; jmp 9f
+ call HIDENAME(mcount); jmp 9f
#define ASENTRY(x) _START_ENTRY \
.globl x; .type x,@function; x:; \
_MID_ENTRY \
- call mcount; 9:
+ call HIDENAME(mcount); 9:
#else /* !PROF */
-#define ENTRY(x) _START_ENTRY .globl _/**/x; .type _/**/x,@function; \
- _/**/x:
+#define ENTRY(x) _START_ENTRY .globl CNAME(x); .type CNAME(x),@function; \
+ CNAME(x):
#define ALTENTRY(x) ENTRY(x)
#define ASENTRY(x) _START_ENTRY .globl x; .type x,@function; x:
diff --git a/lib/libc/i386/SYS.h b/lib/libc/i386/SYS.h
index 9e989e5116af..caea98ff9e23 100644
--- a/lib/libc/i386/SYS.h
+++ b/lib/libc/i386/SYS.h
@@ -35,7 +35,7 @@
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
*
- * $Id: SYS.h,v 1.2 1994/08/05 01:17:57 wollman Exp $
+ * $Id: SYS.h,v 1.3 1996/01/22 00:00:51 julian Exp $
*/
#include <sys/syscall.h>
@@ -61,28 +61,27 @@
#define PIC_GOTOFF(x) x
#endif
-#define SYSCALL(x) 2: jmp cerror; ENTRY(x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
+#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(x); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
#define RSYSCALL(x) SYSCALL(x); ret
-#ifdef _THREAD_SAFE
/*
- * Support for user-space threads which require that some syscalls be
- * private to the threaded library.
+ * For the thread_safe versions, we prepend _thread_sys_ to the function
+ * name so that the 'C' wrapper can go around the real name.
*/
-#define PSYSCALL(x) 2: jmp cerror; ENTRY(_thread_sys_/**/x); lea SYS_/**/x,%eax; LCALL(7,0); jb 2b
-#else
-/*
- * The non-threaded library defaults to traditional syscalls where
- * the function name matches the syscall name.
- */
-#define PSYSCALL(x) SYSCALL(x)
+#ifdef _THREAD_SAFE /* in case */
+#define PSYSCALL(x,y) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); ENTRY(y); lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
+#define PRSYSCALL(x,y) PSYSCALL(x,y); ret
#endif
-#define PRSYSCALL(x) PSYSCALL(x); ret
-#define PSEUDO(x,y) ENTRY(x); lea SYS_/**/y, %eax; ; LCALL(7,0); ret
-#define CALL(x,y) call _/**/y; addl $4*x,%esp
+
+#define PSEUDO(x,y) ENTRY(x); lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
+#define CALL(x,y) call CNAME(y); addl $4*x,%esp
/* gas fucks up offset -- although we don't currently need it, do for BCS */
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
-#define ASMSTR .asciz
+#ifdef __ELF__
+#define KERNCALL int $0x80 /* Faster */
+#else
+#define KERNCALL LCALL(7,0) /* The old way */
+#endif
- .globl cerror
+#define ASMSTR .asciz
diff --git a/lib/libc/i386/gen/modf.S b/lib/libc/i386/gen/modf.S
index 35b993ab1f70..34a89ed4dbce 100644
--- a/lib/libc/i386/gen/modf.S
+++ b/lib/libc/i386/gen/modf.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: modf.S,v 1.2 1995/01/23 01:27:05 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: modf.S,v 1.2 1995/01/23 01:27:05 davidg Exp $"
#endif /* LIBC_RCS and not lint */
/*
@@ -50,10 +50,10 @@
*/
/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */
-.text
-.globl _modf
-.type _modf,@function
-_modf:
+
+#include "DEFS.h"
+
+ENTRY(modf)
pushl %ebp
movl %esp,%ebp
subl $16,%esp
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index 89efa92ccf85..078b2ebc089e 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $
+ * $Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: setjmp.S,v 1.3 1995/01/23 01:27:08 davidg Exp $"
+ .asciz "$Id: setjmp.S,v 1.4 1996/01/22 00:00:53 julian Exp $"
#endif /* LIBC_RCS and not lint */
/*
@@ -59,13 +59,15 @@ ENTRY(_thread_sys_setjmp)
#else
ENTRY(setjmp)
#endif
+ PIC_PROLOGUE
pushl $0
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigblock)
+ call PIC_PLT(CNAME(_thread_sys_sigblock))
#else
- call PIC_PLT(_sigblock)
+ call PIC_PLT(CNAME(sigblock))
#endif
popl %edx
+ PIC_EPILOGUE
movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
@@ -85,13 +87,15 @@ ENTRY(_thread_sys_longjmp)
ENTRY(longjmp)
#endif
movl 4(%esp),%edx
+ PIC_PROLOGUE
pushl 24(%edx)
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigsetmask)
+ call PIC_PLT(CNAME(_thread_sys_sigsetmask))
#else
- call PIC_PLT(_sigsetmask) /* XXX this is not reentrant */
+ call PIC_PLT(CNAME(sigsetmask)) /* XXX this is not reentrant */
#endif
popl %eax
+ PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index 5cc00f054323..1d56f290980f 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $
+ * $Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigsetjmp.S,v 1.5 1996/01/22 00:00:54 julian Exp $"
+ .asciz "$Id: sigsetjmp.S,v 1.6 1996/02/17 12:25:21 peter Exp $"
#endif /* LIBC_RCS and not lint */
#include "DEFS.h"
@@ -69,13 +69,15 @@ ENTRY(sigsetjmp)
movl %eax,32(%ecx)
testl %eax,%eax
jz 1f
+ PIC_PROLOGUE
pushl $0
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigblock)
+ call PIC_PLT(CNAME(_thread_sys_sigblock))
#else
- call PIC_PLT(_sigblock)
+ call PIC_PLT(CNAME(sigblock))
#endif
addl $4,%esp
+ PIC_EPILOGUE
movl 4(%esp),%ecx
movl %eax,24(%ecx)
1: movl 0(%esp),%edx
@@ -97,13 +99,15 @@ ENTRY(siglongjmp)
movl 4(%esp),%edx
cmpl $0,32(%edx)
jz 1f
+ PIC_PROLOGUE
pushl 24(%edx)
#ifdef _THREAD_SAFE
- call PIC_PLT(__thread_sys_sigsetmask)
+ call PIC_PLT(CNAME(_thread_sys_sigsetmask))
#else
- call PIC_PLT(_sigsetmask)
+ call PIC_PLT(CNAME(sigsetmask))
#endif
addl $4,%esp
+ PIC_EPILOGUE
1: movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/i386/sys/Ovfork.S b/lib/libc/i386/sys/Ovfork.S
index 341b75c97381..2b69ca0c16d4 100644
--- a/lib/libc/i386/sys/Ovfork.S
+++ b/lib/libc/i386/sys/Ovfork.S
@@ -33,14 +33,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $
+ * $Id: Ovfork.S,v 1.3 1996/01/22 00:00:56 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: Ovfork.S,v 1.2 1995/01/23 01:29:37 davidg Exp $"
+ .asciz "$Id: Ovfork.S,v 1.3 1996/01/22 00:00:56 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
+#include "DEFS.h"
#include "SYS.h"
/*
@@ -50,14 +51,11 @@
* %eax == pid of child in parent, %eax == pid of parent in child.
*
*/
- .set vfork,66
-.globl _vfork
-.type _vfork,@function
-_vfork:
+ENTRY(vfork)
popl %ecx /* my rta into ecx */
- movl $vfork, %eax
- LCALL(7,0)
+ lea SYS_vfork,%eax
+ KERNCALL
jb verror
vforkok:
cmpl $0,%edx /* child process? */
@@ -67,14 +65,14 @@ vforkok:
/*
* Threaded version using __error().
*/
- .globl ___error
- .type ___error,@function
+ .globl CNAME(__error)
+ .type CNAME(__error),@function
verror:
pushl %eax
#ifdef PIC
- call PIC_PLT(___error)
+ call PIC_PLT(CNAME(__error))
#else
- call ___error
+ call CNAME(__error)
#endif
popl %ecx
movl %ecx,(%eax)
@@ -84,15 +82,15 @@ verror:
/*
* Non-threaded version using global errno.
*/
- .globl _errno
+ .globl CNAME(errno)
verror:
#ifdef PIC
PIC_PROLOGUE
- movl PIC_GOT(_errno), %edx
+ movl PIC_GOT(CNAME(errno)), %edx
movl %eax,(%edx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
movl $-1,%eax
#endif /* !_THREAD_SAFE */
diff --git a/lib/libc/i386/sys/brk.S b/lib/libc/i386/sys/brk.S
index c8311bbf9723..1636858c0d3e 100644
--- a/lib/libc/i386/sys/brk.S
+++ b/lib/libc/i386/sys/brk.S
@@ -33,20 +33,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: brk.S,v 1.1 1994/08/05 01:18:39 wollman Exp $
+ * $Id: brk.S,v 1.2 1995/01/23 01:29:39 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: brk.S,v 1.2 1995/01/23 01:29:39 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-#define SYS_brk 17
-
- .globl curbrk
- .globl minbrk
+ .globl HIDENAME(curbrk)
+ .globl HIDENAME(minbrk)
ENTRY(_brk)
jmp ok
@@ -54,39 +52,40 @@ ENTRY(brk)
#ifdef PIC
movl 4(%esp),%eax
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx # set up GOT addressing
- movl PIC_GOT(minbrk),%ecx #
+ movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing
+ movl PIC_GOT(HIDENAME(minbrk)),%ecx #
cmpl %eax,(%ecx)
PIC_EPILOGUE
jl ok
movl (%ecx),%eax
movl %eax,4(%esp)
ok:
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
movl 4(%esp),%eax
movl %eax,(%edx)
movl $0,%eax
ret
err:
- jmp PIC_PLT(cerror)
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#else
movl 4(%esp),%eax
- cmpl %eax,minbrk
+ cmpl %eax,HIDENAME(minbrk)
jl ok
- movl minbrk,%eax
+ movl HIDENAME(minbrk),%eax
movl %eax,4(%esp)
ok:
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
movl 4(%esp),%eax
- movl %eax,curbrk
+ movl %eax,HIDENAME(curbrk)
movl $0,%eax
ret
err:
- jmp cerror
+ jmp HIDENAME(cerror)
#endif
diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S
index 2cbb0f94ab5b..926dcd9fff0d 100644
--- a/lib/libc/i386/sys/cerror.S
+++ b/lib/libc/i386/sys/cerror.S
@@ -33,28 +33,31 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $
+ * $Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: cerror.S,v 1.3 1995/01/23 01:29:43 davidg Exp $"
+ .asciz "$Id: cerror.S,v 1.4 1996/01/22 00:00:57 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
+ .globl HIDENAME(cerror)
+
#ifdef _THREAD_SAFE
/*
* Threaded version using __error().
*/
- .globl ___error
- .type ___error,@function
-cerror:
+ .globl CNAME(__error)
+ .type CNAME(__error),@function
+HIDENAME(cerror):
pushl %eax
#ifdef PIC
- call PIC_PLT(___error)
+ /* The caller must execute the PIC prologue before jumping to cerror. */
+ call PIC_PLT(CNAME(__error))
#else
- call ___error
+ call CNAME(__error)
#endif
popl %ecx
movl %ecx,(%eax)
@@ -66,15 +69,15 @@ cerror:
/*
* Non-threaded version using global errno.
*/
- .globl _errno
-cerror:
+ .globl CNAME(errno)
+HIDENAME(cerror):
#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(_errno),%ecx
+ /* The caller must execute the PIC prologue before jumping to cerror. */
+ movl PIC_GOT(CNAME(errno)),%ecx
movl %eax,(%ecx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
movl $-1,%eax
movl $-1,%edx
diff --git a/lib/libc/i386/sys/exect.S b/lib/libc/i386/sys/exect.S
index 74a055bd5d28..59ce389f2978 100644
--- a/lib/libc/i386/sys/exect.S
+++ b/lib/libc/i386/sys/exect.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exect.S,v 1.1 1994/08/05 01:18:42 wollman Exp $
+ * $Id: exect.S,v 1.2 1995/01/23 01:29:46 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: exect.S,v 1.2 1995/01/23 01:29:46 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -51,5 +51,6 @@ ENTRY(exect)
orl $ PSL_T,%edx
pushl %edx
popf
- LCALL(7,0)
- jmp cerror /* exect(file, argv, env); */
+ KERNCALL
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror)) /* exect(file, argv, env); */
diff --git a/lib/libc/i386/sys/fork.S b/lib/libc/i386/sys/fork.S
index 567aa4c9dd39..96cb4b6ec1d2 100644
--- a/lib/libc/i386/sys/fork.S
+++ b/lib/libc/i386/sys/fork.S
@@ -33,17 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fork.S,v 1.2 1995/01/23 01:29:48 davidg Exp $
+ * $Id: fork.S,v 1.3 1996/01/22 00:00:57 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: fork.S,v 1.2 1995/01/23 01:29:48 davidg Exp $"
+ .asciz "$Id: fork.S,v 1.3 1996/01/22 00:00:57 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-PSYSCALL(fork)
+#ifdef _THREAD_SAFE
+PSYSCALL(fork,_thread_sys_fork)
+#else
+SYSCALL(fork)
+#endif
cmpl $0,%edx /* parent, since %edx == 0 in parent, 1 in child */
je 1f
movl $0,%eax
diff --git a/lib/libc/i386/sys/pipe.S b/lib/libc/i386/sys/pipe.S
index 809445f0bec7..0dcf8572096b 100644
--- a/lib/libc/i386/sys/pipe.S
+++ b/lib/libc/i386/sys/pipe.S
@@ -33,17 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $
+ * $Id: pipe.S,v 1.3 1996/01/22 00:00:58 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: pipe.S,v 1.2 1995/01/23 01:29:57 davidg Exp $"
+ .asciz "$Id: pipe.S,v 1.3 1996/01/22 00:00:58 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-PSYSCALL(pipe)
+#ifdef _THREAD_SAFE
+PSYSCALL(pipe,_thread_sys_pipe)
+#else
+SYSCALL(pipe)
+#endif
movl 4(%esp),%ecx
movl %eax,(%ecx)
movl %edx,4(%ecx)
diff --git a/lib/libc/i386/sys/ptrace.S b/lib/libc/i386/sys/ptrace.S
index e3ac3a5b667c..993c9be55056 100644
--- a/lib/libc/i386/sys/ptrace.S
+++ b/lib/libc/i386/sys/ptrace.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ptrace.S,v 1.1 1994/08/05 01:18:47 wollman Exp $
+ * $Id: ptrace.S,v 1.2 1995/01/23 01:29:59 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: ptrace.S,v 1.2 1995/01/23 01:29:59 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -47,15 +47,16 @@ ENTRY(ptrace)
xorl %eax,%eax
#ifdef PIC
PIC_PROLOGUE
- movl PIC_GOT(_errno),%edx
+ movl PIC_GOT(CNAME(errno)),%edx
movl %eax,(%edx)
PIC_EPILOGUE
#else
- movl %eax,_errno
+ movl %eax,CNAME(errno)
#endif
lea SYS_ptrace,%eax
- LCALL(7,0)
+ KERNCALL
jb err
ret
err:
- jmp cerror
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
diff --git a/lib/libc/i386/sys/rfork.S b/lib/libc/i386/sys/rfork.S
index 189d399503e6..c1e85e6f80fc 100644
--- a/lib/libc/i386/sys/rfork.S
+++ b/lib/libc/i386/sys/rfork.S
@@ -33,17 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: rfork.S,v 1.1 1996/02/23 19:56:47 peter Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: rfork.S,v 1.1 1996/02/23 19:56:47 peter Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-PSYSCALL(rfork)
+#ifdef _THREAD_SAFE
+PSYSCALL(rfork,_thread_sys_rfork)
+#else
+SYSCALL(rfork)
+#endif
cmpl $0,%edx /* parent, since %edx == 0 in parent, 1 in child */
je 1f
movl $0,%eax
diff --git a/lib/libc/i386/sys/sbrk.S b/lib/libc/i386/sys/sbrk.S
index 2d65b59dbb16..d5c48ddcb724 100644
--- a/lib/libc/i386/sys/sbrk.S
+++ b/lib/libc/i386/sys/sbrk.S
@@ -33,64 +33,63 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $
+ * $Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $"
+ .asciz "$Id: sbrk.S,v 1.3 1995/10/04 15:58:57 phk Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-#define SYS_brk 17
-
- .globl _end
- .globl minbrk
- .globl curbrk
+ .globl CNAME(end)
+ .globl HIDENAME(minbrk)
+ .globl HIDENAME(curbrk)
.data
-minbrk: .long _end
-curbrk: .long _end
+HIDENAME(minbrk): .long CNAME(end)
+HIDENAME(curbrk): .long CNAME(end)
.text
ENTRY(sbrk)
#ifdef PIC
movl 4(%esp),%ecx
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
+ movl PIC_GOT(HIDENAME(curbrk)),%edx
movl (%edx),%eax
PIC_EPILOGUE
testl %ecx,%ecx
jz back
addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
+ movl PIC_GOT(HIDENAME(curbrk)),%edx
movl (%edx),%eax
addl %ecx,(%edx)
PIC_EPILOGUE
back:
ret
err:
- jmp PIC_PLT(cerror)
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#else /* !PIC */
movl 4(%esp),%ecx
- movl curbrk,%eax
+ movl HIDENAME(curbrk),%eax
testl %ecx,%ecx
jz back
addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
- movl curbrk,%eax
- addl %ecx,curbrk
+ movl HIDENAME(curbrk),%eax
+ addl %ecx,HIDENAME(curbrk)
back:
ret
err:
- jmp cerror
+ jmp HIDENAME(cerror)
#endif /* PIC */
diff --git a/lib/libc/i386/sys/setlogin.S b/lib/libc/i386/sys/setlogin.S
index 96c7886ec808..1ec31b9ef760 100644
--- a/lib/libc/i386/sys/setlogin.S
+++ b/lib/libc/i386/sys/setlogin.S
@@ -33,27 +33,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: setlogin.S,v 1.1 1994/08/05 01:18:50 wollman Exp $
+ * $Id: setlogin.S,v 1.2 1995/01/23 01:30:06 davidg Exp $
*/
#if defined(LIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: setlogin.S,v 1.2 1995/01/23 01:30:06 davidg Exp $"
#endif /* LIBC_RCS and not lint */
#include "SYS.h"
-.globl __logname_valid /* in getlogin() */
+.globl CNAME(_logname_valid) /* in getlogin() */
SYSCALL(setlogin)
#ifdef PIC
PIC_PROLOGUE
pushl %eax
- movl PIC_GOT(__logname_valid),%eax
+ movl PIC_GOT(CNAME(_logname_valid)),%eax
movl $0,(%eax)
popl %eax
PIC_EPILOGUE
#else
- movl $0,__logname_valid
+ movl $0,CNAME(_logname_valid)
#endif
ret /* setlogin(name) */
diff --git a/lib/libc/i386/sys/sigpending.S b/lib/libc/i386/sys/sigpending.S
index dba82eef8c6f..a56c8f7ef454 100644
--- a/lib/libc/i386/sys/sigpending.S
+++ b/lib/libc/i386/sys/sigpending.S
@@ -33,17 +33,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigpending.S,v 1.2 1995/01/23 01:30:08 davidg Exp $
+ * $Id: sigpending.S,v 1.3 1996/01/22 00:00:59 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigpending.S,v 1.2 1995/01/23 01:30:08 davidg Exp $"
+ .asciz "$Id: sigpending.S,v 1.3 1996/01/22 00:00:59 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
-PSYSCALL(sigpending)
+#ifdef _THREAD_SAFE
+PSYSCALL(sigpending,_thread_sys_sigpending)
+#else
+SYSCALL(sigpending)
+#endif
movl 4(%esp),%ecx # fetch pointer to...
movl %eax,(%ecx) # store old mask
xorl %eax,%eax
diff --git a/lib/libc/i386/sys/sigprocmask.S b/lib/libc/i386/sys/sigprocmask.S
index 69c50a407472..1f48c6b7c022 100644
--- a/lib/libc/i386/sys/sigprocmask.S
+++ b/lib/libc/i386/sys/sigprocmask.S
@@ -33,18 +33,19 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigprocmask.S,v 1.2 1995/01/23 01:30:11 davidg Exp $
+ * $Id: sigprocmask.S,v 1.3 1996/01/22 00:00:59 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigprocmask.S,v 1.2 1995/01/23 01:30:11 davidg Exp $"
+ .asciz "$Id: sigprocmask.S,v 1.3 1996/01/22 00:00:59 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
err:
- jmp cerror
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#ifdef _THREAD_SAFE
ENTRY(_thread_sys_sigprocmask)
@@ -59,8 +60,8 @@ ENTRY(sigprocmask)
jmp 2f
1: movl (%ecx),%ecx # fetch indirect ...
movl %ecx,8(%esp) # to new mask arg
-2: movl $ SYS_sigprocmask , %eax
- LCALL(0x7,0)
+2: lea SYS_sigprocmask,%eax
+ KERNCALL
jb err
movl 12(%esp),%ecx # fetch old mask requested
cmpl $0,%ecx # test if old mask requested
diff --git a/lib/libc/i386/sys/sigreturn.S b/lib/libc/i386/sys/sigreturn.S
index 6f3f571c616e..cce518b742c3 100644
--- a/lib/libc/i386/sys/sigreturn.S
+++ b/lib/libc/i386/sys/sigreturn.S
@@ -33,25 +33,24 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $
+ * $Id: sigreturn.S,v 1.3 1996/01/22 00:01:00 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigreturn.S,v 1.2 1995/01/23 01:30:16 davidg Exp $"
+ .asciz "$Id: sigreturn.S,v 1.3 1996/01/22 00:01:00 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
/*
- * We must preserve the state of the registers as the user has set them up.
+ * NOTE: If the profiling ENTRY() code ever changes any registers, they
+ * must be saved. On FreeBSD, this is not the case.
*/
-#ifdef PROF
-#undef ENTRY
-#define ENTRY(x) \
- .globl _/**/x; .align 2; _/**/x: pusha ; \
- .data; 1:; .long 0; .text; movl $1b,%eax; call mcount; popa ; nop
-#endif /* PROF */
-PSYSCALL(sigreturn)
+#ifdef _THREAD_SAFE
+PSYSCALL(sigreturn,_thread_sys_sigreturn)
+#else
+SYSCALL(sigreturn)
+#endif
ret
diff --git a/lib/libc/i386/sys/sigsuspend.S b/lib/libc/i386/sys/sigsuspend.S
index 4d70ea693d9b..3d64e4815083 100644
--- a/lib/libc/i386/sys/sigsuspend.S
+++ b/lib/libc/i386/sys/sigsuspend.S
@@ -33,18 +33,19 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigsuspend.S,v 1.2 1995/01/23 01:30:20 davidg Exp $
+ * $Id: sigsuspend.S,v 1.3 1996/01/22 00:01:01 julian Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigsuspend.S,v 1.2 1995/01/23 01:30:20 davidg Exp $"
+ .asciz "$Id: sigsuspend.S,v 1.3 1996/01/22 00:01:01 julian Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
err:
- jmp cerror
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
#ifdef _THREAD_SAFE
ENTRY(_thread_sys_sigsuspend)
@@ -54,8 +55,8 @@ ENTRY(sigsuspend)
movl 4(%esp),%eax # fetch mask arg
movl (%eax),%eax # indirect to mask arg
movl %eax,4(%esp)
- movl $ SYS_sigsuspend ,%eax
- LCALL(0x7,0)
+ lea SYS_sigsuspend,%eax
+ KERNCALL
jb err
xorl %eax,%eax # shouldn t happen
ret
diff --git a/lib/libc/i386/sys/syscall.S b/lib/libc/i386/sys/syscall.S
index 8fcbec9cc1a6..ccc1b93e6901 100644
--- a/lib/libc/i386/sys/syscall.S
+++ b/lib/libc/i386/sys/syscall.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: syscall.S,v 1.1 1994/08/05 01:18:55 wollman Exp $
+ * $Id: syscall.S,v 1.2 1995/01/23 01:30:24 davidg Exp $
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id$"
+ .asciz "$Id: syscall.S,v 1.2 1995/01/23 01:30:24 davidg Exp $"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -47,10 +47,11 @@ ENTRY(syscall)
pop %ecx /* rta */
pop %eax /* syscall number */
push %ecx
- LCALL(7,0)
+ KERNCALL
push %ecx /* need to push a word to keep stack frame intact
upon return; the word must be the return address. */
jb 1f
ret
1:
- jmp cerror
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))