diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-01-06 23:14:19 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-01-06 23:14:19 +0000 |
commit | 21e642825078d715499c3110ace9c6e61f6c6db4 (patch) | |
tree | ee5144fc0de3e0fa69a7f1b80f6a8f9667827821 /lib | |
parent | b580960a28c3e5906e4647a6d710cd78f92238ae (diff) |
_THREAD_SAFE
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/m68k/SYS.h | 63 | ||||
-rw-r--r-- | lib/libc/arch/m68k/sys/Ovfork.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/m68k/sys/sigprocmask.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/m68k/sys/sigreturn.S | 5 | ||||
-rw-r--r-- | lib/libc/arch/m68k/sys/sigsuspend.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/m68k/sys/syscall.S | 4 |
6 files changed, 61 insertions, 23 deletions
diff --git a/lib/libc/arch/m68k/SYS.h b/lib/libc/arch/m68k/SYS.h index d181e5cef17..9cf690dc465 100644 --- a/lib/libc/arch/m68k/SYS.h +++ b/lib/libc/arch/m68k/SYS.h @@ -34,30 +34,67 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: SYS.h,v 1.3 1997/04/17 14:57:31 gvf Exp $ + * $OpenBSD: SYS.h,v 1.4 1999/01/06 23:14:17 d Exp $ */ #include <sys/syscall.h> #include <machine/asm.h> +#define _IMMEDIATE_ # + #ifdef __STDC__ +# define __ENTRY(p,x) ENTRY(p##x) +# define __DO_SYSCALL(x) \ + movl _IMMEDIATE_ SYS_##x, d0; \ + trap _IMMEDIATE_ 0 +# define __LABEL2(p,x) _C_LABEL(p##x) +#else +# define __ENTRY(p,x) ENTRY(p/**/x) +# define __DO_SYSCALL(x) \ + movl _IMMEDIATE_ SYS_/**/x, d0; \ + trap _IMMEDIATE_ 0 +# define __LABEL2(p,x) _C_LABEL(p/**/x) +#endif -#define _IMMEDIATE_ # +/* perform a syscall, set errno */ + +#define __SYSCALL(p,x) \ + .even; \ + err: jra cerror; \ + __ENTRY(p,x); \ + __DO_SYSCALL(x); \ + jcs err -#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \ - movl _IMMEDIATE_ SYS_ ## x,d0; trap _IMMEDIATE_ 0; jcs err -#define RSYSCALL(x) SYSCALL(x); rts -#define PSEUDO(x,y) ENTRY(x); movl _IMMEDIATE_ SYS_ ## y,d0; trap _IMMEDIATE_ 0; rts +/* perform a syscall, set errno, return */ -#undef _IMMEDIATE_ -#else /* !__STDC__ */ +#define __RSYSCALL(p,x) __SYSCALL(p,x); rts -#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \ - movl #SYS_/**/x,d0; trap #0; jcs err -#define RSYSCALL(x) SYSCALL(x); rts -#define PSEUDO(x,y) ENTRY(x); movl #SYS_/**/y,d0; trap #0; rts +/* perform a syscall, return */ -#endif /* !__STDC__ */ +#define __PSEUDO(p,x,y) \ + __ENTRY(p,x); \ + __DO_SYSCALL(y); \ + rts + +#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) +# define RSYSCALL(x) __RSYSCALL(_thread_sys_,x) +# define PSEUDO(x,y) __PSEUDO(_thread_sys_,x,y) +# define SYSENTRY(x) __ENTRY(_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) +# define RSYSCALL(x) __RSYSCALL(,x) +# define PSEUDO(x,y) __PSEUDO(,x,y) +# define SYSENTRY(x) __ENTRY(,x) +#endif _THREAD_SAFE #define ASMSTR .asciz diff --git a/lib/libc/arch/m68k/sys/Ovfork.S b/lib/libc/arch/m68k/sys/Ovfork.S index 0893831c467..4ff4bf42c5d 100644 --- a/lib/libc/arch/m68k/sys/Ovfork.S +++ b/lib/libc/arch/m68k/sys/Ovfork.S @@ -37,7 +37,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: Ovfork.S,v 1.2 1996/08/19 08:15:31 tholo Exp $" + .asciz "$OpenBSD: Ovfork.S,v 1.3 1999/01/06 23:14:17 d Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" @@ -58,7 +58,7 @@ * with a ret off this stack... we do the ret before we vfork! */ -ENTRY(vfork) +SYSENTRY(vfork) movl sp@+,a0 movl #SYS_vfork,d0 trap #0 diff --git a/lib/libc/arch/m68k/sys/sigprocmask.S b/lib/libc/arch/m68k/sys/sigprocmask.S index 2e4dbcb6538..35b57ea0295 100644 --- a/lib/libc/arch/m68k/sys/sigprocmask.S +++ b/lib/libc/arch/m68k/sys/sigprocmask.S @@ -37,12 +37,12 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sigprocmask.S,v 1.2 1996/08/19 08:15:43 tholo Exp $" + .asciz "$OpenBSD: sigprocmask.S,v 1.3 1999/01/06 23:14:17 d Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" -ENTRY(sigprocmask) +SYSENTRY(sigprocmask) tstl sp@(8) /* check new sigset pointer */ jne gotptr /* if not null, indirect */ /* movl #0,sp@(8) /* null mask pointer: block empty set */ diff --git a/lib/libc/arch/m68k/sys/sigreturn.S b/lib/libc/arch/m68k/sys/sigreturn.S index 6131aaee7e7..44fa5e474d3 100644 --- a/lib/libc/arch/m68k/sys/sigreturn.S +++ b/lib/libc/arch/m68k/sys/sigreturn.S @@ -37,7 +37,7 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sigreturn.S,v 1.2 1996/08/19 08:15:44 tholo Exp $" + .asciz "$OpenBSD: sigreturn.S,v 1.3 1999/01/06 23:14:17 d Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" @@ -47,12 +47,13 @@ */ #ifdef PROF #undef ENTRY +/* XXX should bring into line with __ENTRY in SYS.h */ #define ENTRY(x) \ .globl _/**/x; .even; _/**/x:; moveml #0xC0C0,sp@-; .data; \ PROF/**/x:; .long 0; .text; lea PROF/**/x,a0; jbsr mcount; \ moveml sp@+,#0x0303 #endif PROF -ENTRY(sigreturn) +SYSENTRY(sigreturn) trap #1 /* signals sigreturn() */ jra cerror diff --git a/lib/libc/arch/m68k/sys/sigsuspend.S b/lib/libc/arch/m68k/sys/sigsuspend.S index eb1273e219e..a183a9d7641 100644 --- a/lib/libc/arch/m68k/sys/sigsuspend.S +++ b/lib/libc/arch/m68k/sys/sigsuspend.S @@ -37,12 +37,12 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: sigsuspend.S,v 1.2 1996/08/19 08:15:45 tholo Exp $" + .asciz "$OpenBSD: sigsuspend.S,v 1.3 1999/01/06 23:14:18 d Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" -ENTRY(sigsuspend) +SYSENTRY(sigsuspend) movl sp@(4),a0 movl a0@,sp@(4) /* indirect to mask arg */ movl #SYS_sigsuspend,d0 diff --git a/lib/libc/arch/m68k/sys/syscall.S b/lib/libc/arch/m68k/sys/syscall.S index ceef07359bf..8773885f331 100644 --- a/lib/libc/arch/m68k/sys/syscall.S +++ b/lib/libc/arch/m68k/sys/syscall.S @@ -37,12 +37,12 @@ #if defined(SYSLIBC_SCCS) .text - .asciz "$OpenBSD: syscall.S,v 1.2 1996/08/19 08:15:46 tholo Exp $" + .asciz "$OpenBSD: syscall.S,v 1.3 1999/01/06 23:14:18 d Exp $" #endif /* SYSLIBC_SCCS */ #include "SYS.h" -ENTRY(syscall) +SYSENTRY(syscall) clrl d0 trap #0 jcs err |