diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1998-12-21 22:54:57 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1998-12-21 22:54:57 +0000 |
commit | f83983246b73a8e212a652c2a63267ff29d169bb (patch) | |
tree | 75df8991ee8cddb9e93c7bfffac7bb0552354ea7 /lib/libpthread | |
parent | 8aa3d7462dafeadf7492d8fc5822045bb1da4227 (diff) |
MD locking and thread support for hppa
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/arch/hppa/_atomic_lock.c | 21 | ||||
-rw-r--r-- | lib/libpthread/arch/hppa/_spinlock.h | 6 | ||||
-rw-r--r-- | lib/libpthread/arch/hppa/uthread_machdep.h | 38 |
3 files changed, 65 insertions, 0 deletions
diff --git a/lib/libpthread/arch/hppa/_atomic_lock.c b/lib/libpthread/arch/hppa/_atomic_lock.c new file mode 100644 index 00000000000..be47bb99afa --- /dev/null +++ b/lib/libpthread/arch/hppa/_atomic_lock.c @@ -0,0 +1,21 @@ +/* $OpenBSD: _atomic_lock.c,v 1.1 1998/12/21 22:54:55 mickey Exp $ */ +/* + * Atomic lock for hppa + */ +#include "spinlock.h" + +int +_atomic_lock(volatile register_t *lock) +{ + register register_t old; + + __asm__("ldcws 0(%1), %0" : "=r" (old): "r" (lock)); + + return (old == _SPINLOCK_LOCKED); +} + +int +_atomic_is_locked(volatile register_t *lock) +{ + return (*lock == _SPINLOCK_LOCKED); +} diff --git a/lib/libpthread/arch/hppa/_spinlock.h b/lib/libpthread/arch/hppa/_spinlock.h new file mode 100644 index 00000000000..24a82c11472 --- /dev/null +++ b/lib/libpthread/arch/hppa/_spinlock.h @@ -0,0 +1,6 @@ +/* $OpenBSD: _spinlock.h,v 1.1 1998/12/21 22:54:55 mickey Exp $ */ + +#define _SPINLOCK_UNLOCKED (1) +#define _SPINLOCK_LOCKED (0) +typedef int _spinlock_lock_t; + diff --git a/lib/libpthread/arch/hppa/uthread_machdep.h b/lib/libpthread/arch/hppa/uthread_machdep.h new file mode 100644 index 00000000000..161283978ee --- /dev/null +++ b/lib/libpthread/arch/hppa/uthread_machdep.h @@ -0,0 +1,38 @@ +/* + * OpenBSD/hppa machine-dependent thread macros + * + * $OpenBSD: uthread_machdep.h,v 1.1 1998/12/21 22:54:56 mickey Exp $$ + */ + +/* save the floating point state of a thread */ +#define _thread_machdep_save_float_state(thr) \ + { \ + /* fsave privileged instr */ \ + } + +/* restore the floating point state of a thread */ +#define _thread_machdep_restore_float_state(thr) \ + { \ + /* frestore privileged instr */ \ + } + +/* initialise the jmpbuf stack frame so it continues from entry */ + +#define _thread_machdep_thread_create(thr, entry, pattr) \ + { \ + /* entry */ \ + (thr)->saved_jmp_buf[5] = (long) entry; \ + /* stack */ \ + (thr)->saved_jmp_buf[2] = (long) (thr)->stack \ + + (pattr)->stacksize_attr \ + - sizeof(double); \ + } + +#define _thread_machdep_longjmp(a,v) _longjmp(a,v) +#define _thread_machdep_setjmp(a) _setjmp(a) + +struct _machdep_struct { + /* char saved_fp[108]; */ + int dummy; +}; + |