summaryrefslogtreecommitdiff
path: root/lib/libc/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1998-12-23 16:26:27 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1998-12-23 16:26:27 +0000
commitfe14f09a834897ee5b23805bb81a4d9a6c09883c (patch)
tree19bbb315b2e9de7dec2c1655918cc1dd680c89b1 /lib/libc/arch
parentdf35df792ccd0958dca2315d2aef540afeb20743 (diff)
libc_r support
Diffstat (limited to 'lib/libc/arch')
-rw-r--r--lib/libc/arch/hppa/SYS.h49
1 files changed, 42 insertions, 7 deletions
diff --git a/lib/libc/arch/hppa/SYS.h b/lib/libc/arch/hppa/SYS.h
index 664ae9330a6..310ada7e8b4 100644
--- a/lib/libc/arch/hppa/SYS.h
+++ b/lib/libc/arch/hppa/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.1 1998/08/28 20:59:41 mickey Exp $ */
+/* $OpenBSD: SYS.h,v 1.2 1998/12/23 16:26:26 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -34,23 +34,58 @@
#include <machine/asm.h>
#include <machine/vmparam.h>
-#define RSYSCALL(x) !\
-ENTRY(x) !\
+#define __ENTRY(p,x) ENTRY(__CONCAT(p,x))
+#define __EXIT(p,x) EXIT(__CONCAT(p,x))
+
+
+#define __RSYSCALL(p,x) !\
+__ENTRY(p,x) !\
stw rp, FM_ERP(sr0,sp) !\
ldil L%SYSCALLGATE, r1 !\
ble 4(sr7, r1) !\
ldi __CONCAT(SYS_,x),r22!\
or,<> r0,r22,r0 !\
ldw FM_ERP(sr0,sp),rp !\
-EXIT(x)
+__EXIT(p,x)
-#define PSEUDO(x,y) !\
-ENTRY(x) !\
+#define __PSEUDO(p,x,y) !\
+__ENTRY(p,x) !\
stw rp, FM_ERP(sr0,sp) !\
ldil L%SYSCALLGATE, r1 !\
ble 4(sr7, r1) !\
ldi __CONCAT(SYS_,y),r22!\
or,<> r0,r22,r0 !\
ldw FM_ERP(sr0,sp),rp !\
-EXIT(x)
+__EXIT(p,x)
+/*
+ * Design note:
+ *
+ * When the syscalls need to be renamed so they can be handled
+ * specially by the threaded library, these macros insert `_thread_sys_'
+ * in front of their name. This avoids the need to #ifdef _THREAD_SAFE
+ * everywhere that the renamed function needs to be called.
+ * The PASSTHRU macro is later used for system calls that don't need
+ * wrapping. (XXX its a shame the loader can't do this aliasing)
+ */
+#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)*/
+/*# define PASSTHRU(x) __PASSTHRU(_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
+ .globl cerror