summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-02-22 21:28:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-02-22 21:28:23 +0000
commit118b0dcdd81004c19167d42852cf6de5833f59b5 (patch)
tree9b08a1c150e0779a9c4bebac4cb572e7c01bc414 /lib
parentf84bdc0cdb84fc9d8767eec5491b79fd0f3f21aa (diff)
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.h25
-rw-r--r--lib/libc/arch/amd64/sys/sigreturn.S4
-rw-r--r--lib/libc/arch/x86_64/SYS.h25
-rw-r--r--lib/libc/arch/x86_64/sys/sigreturn.S4
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