diff options
Diffstat (limited to 'lib/libpthread/arch/sparc')
-rw-r--r-- | lib/libpthread/arch/sparc/_atomic_lock.c | 43 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/uthread_machdep.c | 49 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/uthread_machdep.h | 11 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/uthread_machdep_asm.S | 97 |
4 files changed, 0 insertions, 200 deletions
diff --git a/lib/libpthread/arch/sparc/_atomic_lock.c b/lib/libpthread/arch/sparc/_atomic_lock.c deleted file mode 100644 index e45bb609837..00000000000 --- a/lib/libpthread/arch/sparc/_atomic_lock.c +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: _atomic_lock.c,v 1.9 2008/10/02 23:27:23 deraadt Exp $ */ -/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ - -/* - * Atomic lock for sparc - */ - -#include "spinlock.h" - -int -_atomic_lock(volatile _spinlock_lock_t * lock) -{ - _spinlock_lock_t old; - - /* - * " ldstub [address], reg_rd - * - * The atomic load-store instructions copy a byte from memory - * into r[rd]m then rewrite the addressed byte in memory to all - * ones [_SPINLOCK_LOCKED]. The operation is performed - * atomically, that is, without allowing intervening interrupts - * or deferred traps. In a multiprocessor system, two or more - * processors executing atomic load-store unsigned byte [...] - * addressing the same byte [...] simultaneously are guaranteed - * to execute them in an undefined, but serial order." - * - p101, The SPARC Architecture Manual (version 8) Prentice-Hall - * - * "LDSTUB loads a byte value from memory to a register and writes - * the value FF_16 into the addressed byte atomically. LDSTUB - * is the classic test-and-set instruction. Like SWAP, it has - * a consensus number of two and so cannot resolve more than - * two contending processes in a wait-free fashion." - * - p129, The SPARC Architecture Manual (version 9) Prentice-Hall - * (See also section J.6 (spinlocks)) - * - * (No change to the condition codes are documented.) - */ - __asm__("ldstub %0,%1" - : "=m" (*lock), "=r" (old) - : "0" (*lock)); - - return (old == _SPINLOCK_LOCKED); -} diff --git a/lib/libpthread/arch/sparc/uthread_machdep.c b/lib/libpthread/arch/sparc/uthread_machdep.c deleted file mode 100644 index f7599ef4636..00000000000 --- a/lib/libpthread/arch/sparc/uthread_machdep.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: uthread_machdep.c,v 1.3 2003/01/31 04:46:16 marc Exp $ */ - -/* - * Machine-dependent thread state functions for OpenBSD/sparc. - */ - -#include <machine/frame.h> -#include <machine/param.h> -#include <pthread.h> -#include "pthread_private.h" - -extern void _thread_machdep_fpsave(u_int32_t *, u_int64_t *); -extern void _thread_machdep_fprestore(u_int32_t *, u_int64_t *); - -/* - * Given a stack and an entry function, initialise a state - * structure that can be later switched to. - */ -void -_thread_machdep_init(statep, base, len, entry) - struct _machdep_state* statep; - void *base; - int len; - void (*entry)(void); -{ - struct frame *f; - - /* Locate the initial frame, aligned at the top of the stack */ - f = (struct frame *)(((int)base + len - sizeof *f) & ~ALIGNBYTES); - - f->fr_fp = (struct frame *)-1; /* purposefully misaligned */ - f->fr_pc = -1; /* for gdb */ - statep->fp = (int)f; - statep->pc = -8 + (int)entry; -} - -void -_thread_machdep_save_float_state(statep) - struct _machdep_state* statep; -{ - _thread_machdep_fpsave(&statep->fs_csr, &statep->fs_regs[0]); -} - -void -_thread_machdep_restore_float_state(statep) - struct _machdep_state* statep; -{ - _thread_machdep_fprestore(&statep->fs_csr, &statep->fs_regs[0]); -} diff --git a/lib/libpthread/arch/sparc/uthread_machdep.h b/lib/libpthread/arch/sparc/uthread_machdep.h deleted file mode 100644 index 087d47de53d..00000000000 --- a/lib/libpthread/arch/sparc/uthread_machdep.h +++ /dev/null @@ -1,11 +0,0 @@ -/* $OpenBSD: uthread_machdep.h,v 1.6 2003/01/26 20:24:36 jason Exp $ */ -/* David Leonard, <d@csee.uq.edu.au>. Public domain. */ - -struct _machdep_state { - int fp; /* frame pointer */ - int pc; /* program counter */ - - u_int32_t fs_csr; /* FP control/status */ - u_int32_t fs_enabled; /* enabled? */ - u_int64_t fs_regs[16]; /* 16 64bit registers */ -}; diff --git a/lib/libpthread/arch/sparc/uthread_machdep_asm.S b/lib/libpthread/arch/sparc/uthread_machdep_asm.S deleted file mode 100644 index 03baf530bef..00000000000 --- a/lib/libpthread/arch/sparc/uthread_machdep_asm.S +++ /dev/null @@ -1,97 +0,0 @@ -/* $OpenBSD: uthread_machdep_asm.S,v 1.9 2004/02/02 20:43:37 brad Exp $ */ -/* David Leonard <d@csee.uq.edu.au>. Public domain. */ - -#include <machine/asm.h> -#include <machine/trap.h> - -/* - * Switch stacks. - * On sparc this also means we switch register windows. - */ - -#define SA(x) (((x)+7)&(~0x7)) -#define MINFRAME ((16+1+6)*4) - -/* - * void _thread_machdep_switch(newstate, oldstate); - * struct _machdep_state *newstate, *oldstate; - */ -ENTRY(_thread_machdep_switch) - - /* new window */ - save %sp, -SA(MINFRAME), %sp - - /* flush all windows (except current one) into memory frames */ - t ST_FLUSHWIN - - /* switch the stack pointer and return address */ - st %fp, [%i1 + 0] - st %i7, [%i1 + 4] - ld [%i0 + 0], %fp - ld [%i0 + 4], %i7 - - /* return to saved window at new %fp */ - ret - restore - -/* - * void _thread_machdep_fpsave(csr, regs) - * u_int32_t *csr; - * u_int64_t *regs; - */ -ENTRY(_thread_machdep_fpsave) - /* - * If %psr were readable, exitting could be faster. The EF - * bit is only set if the FPU is enabled, and we only need - * to save fpu state if it is enabled. But, RDPSR is a - * privileged instruction. - */ - - /* save registers */ - st %fsr, [%o0] - std %f0, [%o1 + 0 * 8] - std %f2, [%o1 + 1 * 8] - std %f4, [%o1 + 2 * 8] - std %f6, [%o1 + 3 * 8] - std %f8, [%o1 + 4 * 8] - std %f10, [%o1 + 5 * 8] - std %f12, [%o1 + 6 * 8] - std %f14, [%o1 + 7 * 8] - std %f16, [%o1 + 8 * 8] - std %f18, [%o1 + 9 * 8] - std %f20, [%o1 + 10 * 8] - std %f22, [%o1 + 11 * 8] - std %f24, [%o1 + 12 * 8] - std %f26, [%o1 + 13 * 8] - std %f28, [%o1 + 14 * 8] - std %f30, [%o1 + 15 * 8] - retl - nop - -/* - * void _thread_machdep_fprestore(csr, regs) - * u_int32_t *csr; - * u_int64_t *regs; - */ -ENTRY(_thread_machdep_fprestore) - ldd [%o1 + 0 * 8], %f0 - ldd [%o1 + 1 * 8], %f2 - ldd [%o1 + 2 * 8], %f4 - ldd [%o1 + 3 * 8], %f6 - ldd [%o1 + 4 * 8], %f8 - ldd [%o1 + 5 * 8], %f10 - ldd [%o1 + 6 * 8], %f12 - ldd [%o1 + 7 * 8], %f14 - ldd [%o1 + 8 * 8], %f16 - ldd [%o1 + 9 * 8], %f18 - ldd [%o1 + 10 * 8], %f20 - ldd [%o1 + 11 * 8], %f22 - ldd [%o1 + 12 * 8], %f24 - ldd [%o1 + 13 * 8], %f26 - ldd [%o1 + 14 * 8], %f28 - ldd [%o1 + 15 * 8], %f30 - ld [%o0], %fsr - /* ldfsr needs three instructions to be stable, ensure that here */ - nop - retl - nop |