summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2001-08-23 21:58:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2001-08-23 21:58:42 +0000
commite9fa830437fca9c49f1c7025cddc61d82ca20d62 (patch)
tree849b13d6e2b932f3817d8e637ae756b6092a6b09 /lib
parent1dea3bdc4dd8877412025f52c70fd4412f957a1c (diff)
Fix the syscall wrappers name generation in, so that libc_r gets the
correct entry points and programs can link to it. I would have commited this later, but fgs@ insisted.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/arch/vax/SYS.h70
-rw-r--r--lib/libc/arch/vax/gen/setjmp.S10
-rw-r--r--lib/libc/arch/vax/sys/Ovfork.S4
-rw-r--r--lib/libc/arch/vax/sys/exect.S4
-rw-r--r--lib/libc/arch/vax/sys/sigprocmask.S4
-rw-r--r--lib/libc/arch/vax/sys/sigsuspend.S4
-rw-r--r--lib/libc/arch/vax/sys/syscall.S4
7 files changed, 54 insertions, 46 deletions
diff --git a/lib/libc/arch/vax/SYS.h b/lib/libc/arch/vax/SYS.h
index 00e49b584b9..27fbc42d8a4 100644
--- a/lib/libc/arch/vax/SYS.h
+++ b/lib/libc/arch/vax/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.4 1998/05/14 23:06:56 niklas Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2001/08/23 21:58:37 miod Exp $ */
/* $NetBSD: SYS.h,v 1.4 1997/05/02 18:15:32 kleink Exp $ */
/*
@@ -38,40 +38,48 @@
#include <sys/syscall.h>
#ifdef __STDC__
-#define SYSTRAP(x) chmk $ SYS_ ## x
+#define _CAT(x,y) x##y
+#define __ENTRY(p,x) ENTRY(p##x,0)
+#define __DO_SYSCALL(x) chmk $ SYS_ ## x
#else
-#define SYSTRAP(x) chmk $ SYS_/**/x
+#define _CAT(x,y) x/**/y
+#define __ENTRY(p,x) ENTRY(p/**/x,0)
+#define __DO_SYSCALL(x) chmk $ SYS_/**/x
#endif
-#define _SYSCALL_NOERROR(x,y) \
- ENTRY(x,0); \
- SYSTRAP(y)
+#define __SYSCALL(p,x,y) \
+ err: jmp cerror; \
+ __ENTRY(p,x); \
+ __DO_SYSCALL(y); \
+ jcs err
-#define _SYSCALL(x,y) \
- err: jmp cerror; \
- _SYSCALL_NOERROR(x,y); \
- jcs err
+#define __PSEUDO(p,x,y) \
+ err: jmp cerror; \
+ __ENTRY(p,x); \
+ __DO_SYSCALL(y); \
+ jcs err; \
+ ret
-#define SYSCALL_NOERROR(x) \
- _SYSCALL_NOERROR(x,x)
-
-#define SYSCALL(x) \
- _SYSCALL(x,x)
-
-#define PSEUDO_NOERROR(x,y) \
- _SYSCALL_NOERROR(x,y); \
- ret
-
-#define PSEUDO(x,y) \
- _SYSCALL(x,y); \
- ret
-
-#define RSYSCALL_NOERROR(x) \
- PSEUDO_NOERROR(x,x)
-
-#define RSYSCALL(x) \
- PSEUDO(x,x)
-
-#define ASMSTR .asciz
+#ifdef _THREAD_SAFE
+/*
+ * 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 SYSCALL(x) __SYSCALL(_thread_sys_,x,x)
+#define RSYSCALL(x) __PSEUDO(_thread_sys_,x,x)
+#define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y)
+#define SYSENTRY(x) __ENTRY(_thread_sys_,x)
+#define SYSNAME(x) _CAT(__thread_sys_,x)
+#else _THREAD_SAFE
+/*
+ * The non-threaded library defaults to traditional syscalls where
+ * the function name matches the syscall name.
+ */
+#define SYSCALL(x) __SYSCALL(,x,x)
+#define RSYSCALL(x) __PSEUDO(,x,x)
+#define PSEUDO(x,y) __PSEUDO(,x,y)
+#define SYSENTRY(x) __ENTRY(,x)
+#define SYSNAME(x) _CAT(_,x)
+#endif _THREAD_SAFE
.globl cerror
diff --git a/lib/libc/arch/vax/gen/setjmp.S b/lib/libc/arch/vax/gen/setjmp.S
index 74744135fb3..40f342b5bdd 100644
--- a/lib/libc/arch/vax/gen/setjmp.S
+++ b/lib/libc/arch/vax/gen/setjmp.S
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS)
.text
- .asciz "$OpenBSD: setjmp.S,v 1.3 2001/03/18 07:29:04 bjc Exp $"
+ .asciz "$OpenBSD: setjmp.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* LIBC_SCCS */
/*
@@ -47,17 +47,17 @@
* and a struct sigcontext, see <signal.h>
*/
-#include "DEFS.h"
+#include "SYS.h"
ENTRY(setjmp, R6)
movl 4(ap),r6 # construct sigcontext
subl2 $12,sp # space for current struct sigstack
pushl sp # get current values
pushl $0 # no new values
- calls $4,_sigaltstack # pop args plus signal stack value
+ calls $4,SYSNAME(sigaltstack)# pop args plus signal stack value
movl (sp)+,(r6)+ # save onsigstack status of caller
pushl $0
- calls $1,_sigblock # get signal mask
+ calls $1,SYSNAME(sigblock) # get signal mask
movl r0,(r6)+ # save signal mask of caller
movl (ap),r0
moval 4(ap)[r0],(r6)+ # save sp of caller
@@ -90,7 +90,7 @@ loop:
done:
pushl r1 # pointer to sigcontext
- calls $1,_sigreturn # restore previous context
+ calls $1,SYSNAME(sigreturn) # restore previous context
# we should never return
botch:
calls $0,_longjmperror
diff --git a/lib/libc/arch/vax/sys/Ovfork.S b/lib/libc/arch/vax/sys/Ovfork.S
index 05ba63c06f1..958ab8e3f94 100644
--- a/lib/libc/arch/vax/sys/Ovfork.S
+++ b/lib/libc/arch/vax/sys/Ovfork.S
@@ -33,7 +33,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: Ovfork.S,v 1.3 1998/05/17 10:06:28 niklas Exp $"
+ .asciz "$OpenBSD: Ovfork.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* SYSLIBC_SCCS */
/*
@@ -54,7 +54,7 @@
* with a ret off this stack... we do the ret before we vfork!
*/
-ENTRY(vfork, 0)
+SYSENTRY(vfork)
movl 16(fp),r2 # save return address before we smash it
movab here,16(fp)
ret
diff --git a/lib/libc/arch/vax/sys/exect.S b/lib/libc/arch/vax/sys/exect.S
index 432df7adbf0..8c04233d1fa 100644
--- a/lib/libc/arch/vax/sys/exect.S
+++ b/lib/libc/arch/vax/sys/exect.S
@@ -33,13 +33,13 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: exect.S,v 1.3 1998/05/17 10:06:31 niklas Exp $"
+ .asciz "$OpenBSD: exect.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* SYSLIBC_SCCS */
#include "SYS.h"
#include <machine/psl.h>
-ENTRY(exect, 0)
+SYSENTRY(exect)
bispsw $PSL_T
chmk $ SYS_execve
jmp cerror # exect(file, argv, env)
diff --git a/lib/libc/arch/vax/sys/sigprocmask.S b/lib/libc/arch/vax/sys/sigprocmask.S
index 3a473eedfde..f830bc1c08d 100644
--- a/lib/libc/arch/vax/sys/sigprocmask.S
+++ b/lib/libc/arch/vax/sys/sigprocmask.S
@@ -33,7 +33,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sigprocmask.S,v 1.3 1998/05/17 10:06:36 niklas Exp $"
+ .asciz "$OpenBSD: sigprocmask.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* SYSLIBC_SCCS */
#include "SYS.h"
@@ -41,7 +41,7 @@
err:
jmp cerror
-ENTRY(sigprocmask, 0)
+SYSENTRY(sigprocmask)
tstl 8(ap) # check new sigset pointer
bneq 1f # if not null, indirect
/* movl $0,8(ap) # null mask pointer: block empty set */
diff --git a/lib/libc/arch/vax/sys/sigsuspend.S b/lib/libc/arch/vax/sys/sigsuspend.S
index 253d4f94d02..445f6e5db4a 100644
--- a/lib/libc/arch/vax/sys/sigsuspend.S
+++ b/lib/libc/arch/vax/sys/sigsuspend.S
@@ -33,7 +33,7 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: sigsuspend.S,v 1.3 1998/05/17 10:06:39 niklas Exp $"
+ .asciz "$OpenBSD: sigsuspend.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* SYSLIBC_SCCS */
#include "SYS.h"
@@ -41,7 +41,7 @@
err:
jmp cerror
-ENTRY(sigsuspend, 0)
+SYSENTRY(sigsuspend)
movl *4(ap),4(ap) # indirect to mask arg
chmk $ SYS_sigsuspend
jcs err
diff --git a/lib/libc/arch/vax/sys/syscall.S b/lib/libc/arch/vax/sys/syscall.S
index 4760ba8f3e4..c8ad8befdcc 100644
--- a/lib/libc/arch/vax/sys/syscall.S
+++ b/lib/libc/arch/vax/sys/syscall.S
@@ -38,12 +38,12 @@
#if defined(SYSLIBC_SCCS)
.text
- .asciz "$OpenBSD: syscall.S,v 1.3 1998/05/17 10:06:42 niklas Exp $"
+ .asciz "$OpenBSD: syscall.S,v 1.4 2001/08/23 21:58:41 miod Exp $"
#endif /* SYSLIBC_SCCS */
#include "SYS.h"
-ENTRY(syscall, 0)
+SYSENTRY(syscall)
movl 4(ap),r0 # syscall number
subl3 $1,(ap)+,(ap) # one fewer arguments
chmk r0