diff options
author | 2004-02-22 21:28:21 +0000 | |
---|---|---|
committer | 2004-02-22 21:28:21 +0000 | |
commit | 9610ec3165325e8deb1c806595ced77f85ecdf43 (patch) | |
tree | 885e7a1f9fac56bbf9c927294c34bbbb16ab1149 /lib | |
parent | - Make comment about parameters passed by /boot reflect reality (diff) | |
download | wireguard-openbsd-9610ec3165325e8deb1c806595ced77f85ecdf43.tar.xz wireguard-openbsd-9610ec3165325e8deb1c806595ced77f85ecdf43.zip |
Define OSYSCALL* macros, as their SYSCALL* counterparts, but using the
int 0x80 mechanism; and use OSYSCALL for sigreturn() as done in the
sigcode.
Naming borrowed from NetBSD.
ok deraadt@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/amd64/SYS.h | 25 | ||||
-rw-r--r-- | lib/libc/arch/amd64/sys/sigreturn.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/SYS.h | 25 | ||||
-rw-r--r-- | lib/libc/arch/x86_64/sys/sigreturn.S | 4 |
4 files changed, 52 insertions, 6 deletions
diff --git a/lib/libc/arch/amd64/SYS.h b/lib/libc/arch/amd64/SYS.h index f6364d9553a..ebac9b0df16 100644 --- a/lib/libc/arch/amd64/SYS.h +++ b/lib/libc/arch/amd64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.2 2004/02/06 18:19:19 deraadt Exp $ */ +/* $OpenBSD: SYS.h,v 1.3 2004/02/22 21:28:21 miod Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -49,6 +49,7 @@ #ifdef __STDC__ #define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall +#define OSYSTRAP(x) movl $(SYS_ ## x),%eax; int $0x80 #define SYSENTRY(x) \ ENTRY(_thread_sys_ ## x); \ .weak _C_LABEL(x); \ @@ -56,6 +57,7 @@ #else #define SYSTRAP(x) movl $(SYS_/**/x),%eax; movq %rcx, %r10; syscall +#define OSYSTRAP(x) movl $(SYS_/**/x),%eax; int $0x80 #define SYSENTRY(x) \ ENTRY(_thread_sys_/**/x); \ .weak _C_LABEL(x); \ @@ -70,6 +72,10 @@ SYSENTRY(x); \ SYSTRAP(y) +#define _OSYSCALL_NOERROR(x,y) \ + SYSENTRY(x); \ + OSYSTRAP(y) + #ifdef PIC #define _SYSCALL(x,y) \ .text; _ALIGN_TEXT; \ @@ -77,20 +83,37 @@ jmp *%rcx; \ _SYSCALL_NOERROR(x,y); \ jc 2b +#define _OSYSCALL(x,y) \ + .text; _ALIGN_TEXT; \ + 2: mov PIC_GOT(CERROR), %rcx; \ + jmp *%rcx; \ + _OSYSCALL_NOERROR(x,y); \ + jc 2b #else #define _SYSCALL(x,y) \ .text; _ALIGN_TEXT; \ 2: jmp CERROR; \ _SYSCALL_NOERROR(x,y); \ jc 2b +#define _OSYSCALL(x,y) \ + .text; _ALIGN_TEXT; \ + 2: jmp CERROR; \ + _OSYSCALL_NOERROR(x,y); \ + jc 2b #endif #define SYSCALL_NOERROR(x) \ _SYSCALL_NOERROR(x,x) +#define OSYSCALL_NOERROR(x) \ + _OSYSCALL_NOERROR(x,x) + #define SYSCALL(x) \ _SYSCALL(x,x) +#define OSYSCALL(x) \ + _OSYSCALL(x,x) + #define PSEUDO_NOERROR(x,y) \ _SYSCALL_NOERROR(x,y); \ ret diff --git a/lib/libc/arch/amd64/sys/sigreturn.S b/lib/libc/arch/amd64/sys/sigreturn.S index e065cbc894d..0faf6942988 100644 --- a/lib/libc/arch/amd64/sys/sigreturn.S +++ b/lib/libc/arch/amd64/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.2 2004/02/22 21:28:22 miod Exp $ */ /* $NetBSD: __sigreturn14.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ /*- @@ -56,5 +56,5 @@ #endif /* GPROF */ #endif -SYSCALL(sigreturn) +OSYSCALL(sigreturn) ret diff --git a/lib/libc/arch/x86_64/SYS.h b/lib/libc/arch/x86_64/SYS.h index f6364d9553a..ebac9b0df16 100644 --- a/lib/libc/arch/x86_64/SYS.h +++ b/lib/libc/arch/x86_64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.2 2004/02/06 18:19:19 deraadt Exp $ */ +/* $OpenBSD: SYS.h,v 1.3 2004/02/22 21:28:21 miod Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -49,6 +49,7 @@ #ifdef __STDC__ #define SYSTRAP(x) movl $(SYS_ ## x),%eax; movq %rcx, %r10; syscall +#define OSYSTRAP(x) movl $(SYS_ ## x),%eax; int $0x80 #define SYSENTRY(x) \ ENTRY(_thread_sys_ ## x); \ .weak _C_LABEL(x); \ @@ -56,6 +57,7 @@ #else #define SYSTRAP(x) movl $(SYS_/**/x),%eax; movq %rcx, %r10; syscall +#define OSYSTRAP(x) movl $(SYS_/**/x),%eax; int $0x80 #define SYSENTRY(x) \ ENTRY(_thread_sys_/**/x); \ .weak _C_LABEL(x); \ @@ -70,6 +72,10 @@ SYSENTRY(x); \ SYSTRAP(y) +#define _OSYSCALL_NOERROR(x,y) \ + SYSENTRY(x); \ + OSYSTRAP(y) + #ifdef PIC #define _SYSCALL(x,y) \ .text; _ALIGN_TEXT; \ @@ -77,20 +83,37 @@ jmp *%rcx; \ _SYSCALL_NOERROR(x,y); \ jc 2b +#define _OSYSCALL(x,y) \ + .text; _ALIGN_TEXT; \ + 2: mov PIC_GOT(CERROR), %rcx; \ + jmp *%rcx; \ + _OSYSCALL_NOERROR(x,y); \ + jc 2b #else #define _SYSCALL(x,y) \ .text; _ALIGN_TEXT; \ 2: jmp CERROR; \ _SYSCALL_NOERROR(x,y); \ jc 2b +#define _OSYSCALL(x,y) \ + .text; _ALIGN_TEXT; \ + 2: jmp CERROR; \ + _OSYSCALL_NOERROR(x,y); \ + jc 2b #endif #define SYSCALL_NOERROR(x) \ _SYSCALL_NOERROR(x,x) +#define OSYSCALL_NOERROR(x) \ + _OSYSCALL_NOERROR(x,x) + #define SYSCALL(x) \ _SYSCALL(x,x) +#define OSYSCALL(x) \ + _OSYSCALL(x,x) + #define PSEUDO_NOERROR(x,y) \ _SYSCALL_NOERROR(x,y); \ ret diff --git a/lib/libc/arch/x86_64/sys/sigreturn.S b/lib/libc/arch/x86_64/sys/sigreturn.S index e065cbc894d..0faf6942988 100644 --- a/lib/libc/arch/x86_64/sys/sigreturn.S +++ b/lib/libc/arch/x86_64/sys/sigreturn.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigreturn.S,v 1.1 2004/01/28 01:44:45 mickey Exp $ */ +/* $OpenBSD: sigreturn.S,v 1.2 2004/02/22 21:28:22 miod Exp $ */ /* $NetBSD: __sigreturn14.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */ /*- @@ -56,5 +56,5 @@ #endif /* GPROF */ #endif -SYSCALL(sigreturn) +OSYSCALL(sigreturn) ret |