summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/arch/sparc
diff options
context:
space:
mode:
authord <d@openbsd.org>1998-11-20 11:15:35 +0000
committerd <d@openbsd.org>1998-11-20 11:15:35 +0000
commitea03e63fbd0d2b427542c2481ae506ce9e278791 (patch)
tree6a43235671adbd8289e0d0a14275441a0d653748 /lib/libpthread/arch/sparc
parentfix strcat usage; deraadt (diff)
downloadwireguard-openbsd-ea03e63fbd0d2b427542c2481ae506ce9e278791.tar.xz
wireguard-openbsd-ea03e63fbd0d2b427542c2481ae506ce9e278791.zip
Move atomic_lock code from asm to C with inline asm;
Add m68k, mips and sparc. (needs more careful checking) Add 'slow_atomic_lock' for crippled archs.
Diffstat (limited to 'lib/libpthread/arch/sparc')
-rw-r--r--lib/libpthread/arch/sparc/_atomic_lock.c10
-rw-r--r--lib/libpthread/arch/sparc/uthread_machdep.h45
2 files changed, 55 insertions, 0 deletions
diff --git a/lib/libpthread/arch/sparc/_atomic_lock.c b/lib/libpthread/arch/sparc/_atomic_lock.c
new file mode 100644
index 00000000000..35b50e3ada5
--- /dev/null
+++ b/lib/libpthread/arch/sparc/_atomic_lock.c
@@ -0,0 +1,10 @@
+/* $OpenBSD */
+/* atomic lock for sparc */
+
+#include "spinlock.h"
+
+register_t
+_atomic_lock(volatile register_t * lock)
+{
+ return _thread_slow_atomic_lock(lock);
+}
diff --git a/lib/libpthread/arch/sparc/uthread_machdep.h b/lib/libpthread/arch/sparc/uthread_machdep.h
new file mode 100644
index 00000000000..56103122674
--- /dev/null
+++ b/lib/libpthread/arch/sparc/uthread_machdep.h
@@ -0,0 +1,45 @@
+/*
+ * OpenBSD/sparc machine-dependent thread macros
+ *
+ * $OpenBSD: uthread_machdep.h,v 1.1 1998/11/20 11:15:37 d Exp $
+ */
+
+#include <sys/signal.h>
+
+/* save the floating point state of a thread */
+#define _thread_machdep_save_float_state(thr) \
+ { \
+ /* XXX tdb */ \
+ }
+
+/* restore the floating point state of a thread */
+#define _thread_machdep_restore_float_state(thr) \
+ { \
+ /* XXX tdb */ \
+ }
+
+/* initialise the jmpbuf stack frame so it continues from entry */
+
+#define _thread_machdep_thread_create(thr, entry, pattr) \
+ { \
+ /* entry */ \
+ (thr)->saved_jmp_buf[1] = (long) entry; \
+ /* stack */ \
+ (thr)->saved_jmp_buf[0] = (long) (thr)->stack \
+ + (pattr)->stacksize_attr \
+ - sizeof(double); \
+ }
+
+/*
+ * XXX high chance of longjmp botch (see libc/arch/sparc/gen/_setjmp.S)
+ * because it uses the frame pointer to pop off frames.. we don't want
+ * that.. what to do? fudge %fp? do our own setjmp?
+ */
+#define _thread_machdep_longjmp(a,v) _longjmp(a,v)
+#define _thread_machdep_setjmp(a) _setjmp(a)
+
+struct _machdep_struct {
+ /* char saved_fp[???]; */
+ int dummy;
+};
+