summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/arch/sparc64
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-09-01 00:32:23 +0000
committerguenther <guenther@openbsd.org>2012-09-01 00:32:23 +0000
commitcde6fc201d55f174c423caf7560c454b29da406e (patch)
tree3c8a6d2fd05c6c6d8d34297c0d9d94bea91bbc5b /lib/libpthread/arch/sparc64
parentmodload needs to invoke ld with -nopie now on ELF platforms (diff)
downloadwireguard-openbsd-cde6fc201d55f174c423caf7560c454b29da406e.tar.xz
wireguard-openbsd-cde6fc201d55f174c423caf7560c454b29da406e.zip
So passes uthreads
Like autumn leaves on water don't fear the tedu@
Diffstat (limited to 'lib/libpthread/arch/sparc64')
-rw-r--r--lib/libpthread/arch/sparc64/_atomic_lock.c43
-rw-r--r--lib/libpthread/arch/sparc64/uthread_machdep.c47
-rw-r--r--lib/libpthread/arch/sparc64/uthread_machdep.h15
-rw-r--r--lib/libpthread/arch/sparc64/uthread_machdep_asm.S135
4 files changed, 0 insertions, 240 deletions
diff --git a/lib/libpthread/arch/sparc64/_atomic_lock.c b/lib/libpthread/arch/sparc64/_atomic_lock.c
deleted file mode 100644
index de4548fb3a8..00000000000
--- a/lib/libpthread/arch/sparc64/_atomic_lock.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: _atomic_lock.c,v 1.5 2008/10/02 23:27:23 deraadt Exp $ */
-/* David Leonard, <d@csee.uq.edu.au>. Public domain. */
-
-/*
- * Atomic lock for sparc64
- */
-
-#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/sparc64/uthread_machdep.c b/lib/libpthread/arch/sparc64/uthread_machdep.c
deleted file mode 100644
index 06be142b4ee..00000000000
--- a/lib/libpthread/arch/sparc64/uthread_machdep.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: uthread_machdep.c,v 1.4 2004/02/02 10:05:55 brad Exp $ */
-
-/*
- * Machine-dependent thread state functions for OpenBSD/sparc64.
- */
-
-#include <sys/types.h>
-#include <machine/frame.h>
-#include <machine/param.h>
-#include <pthread.h>
-#include "pthread_private.h"
-
-/*
- * 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 frame64 *f;
-
- /* Locate the initial frame, aligned at the top of the stack */
- f = (struct frame64 *)(((long)base + len - sizeof *f) & ~ALIGNBYTES);
-
- f->fr_fp = 0; /* purposefully misaligned */
- f->fr_pc = -1; /* for gdb */
- statep->fp = (u_long)f - BIAS;
- statep->pc = -8 + (u_long)entry;
-}
-
-void
-_thread_machdep_save_float_state(statep)
- struct _machdep_state* statep;
-{
- _thread_machdep_fpsave(&statep->fs_fprs);
-}
-
-void
-_thread_machdep_restore_float_state(statep)
- struct _machdep_state* statep;
-{
- _thread_machdep_fprestore(&statep->fs_fprs);
-}
diff --git a/lib/libpthread/arch/sparc64/uthread_machdep.h b/lib/libpthread/arch/sparc64/uthread_machdep.h
deleted file mode 100644
index 4c746423983..00000000000
--- a/lib/libpthread/arch/sparc64/uthread_machdep.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $OpenBSD: uthread_machdep.h,v 1.3 2003/01/24 21:05:45 jason Exp $ */
-/* Arutr Grabowski <art@openbsd.org>. Public domain. */
-
-struct _machdep_state {
- long fp; /* frame pointer */
- long pc; /* program counter */
-
- /* floating point state */
- u_int64_t fs_fprs; /* fp register window status */
- u_int64_t fs_fsr; /* fp status */
- u_int64_t fs_regs[32]; /* 32 64 bit registers */
-};
-
-extern void _thread_machdep_fpsave(u_int64_t *);
-extern void _thread_machdep_fprestore(u_int64_t *);
diff --git a/lib/libpthread/arch/sparc64/uthread_machdep_asm.S b/lib/libpthread/arch/sparc64/uthread_machdep_asm.S
deleted file mode 100644
index 7b4ab4cea94..00000000000
--- a/lib/libpthread/arch/sparc64/uthread_machdep_asm.S
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $OpenBSD: uthread_machdep_asm.S,v 1.9 2010/05/25 20:05:48 kettenis Exp $ */
-/* David Leonard <d@csee.uq.edu.au>. Public domain. */
-
-#include <machine/asm.h>
-#include <machine/trap.h>
-#include <machine/frame.h>
-
-/*
- * Switch stacks.
- *
- * On sparc64 this also means we switch register windows.
- */
-
-/*
- * void _thread_machdep_switch(long newstate[2], long savestate[2], int flags);
- */
-ENTRY(_thread_machdep_switch)
-
- /* new window */
- save %sp, -CC64FSZ, %sp
-
- /* flush all windows (except current one) into memory frames */
- flushw
-
- /* switch the stack pointer and return address */
- stx %fp, [%i1 + 0]
- stx %i7, [%i1 + 8]
- ldx [%i0 + 0], %fp
- ldx [%i0 + 8], %i7
-
- /* return to saved window at new %fp */
- ret
- restore
-
-#define FPRS_ENA 0x4 /* fpu enabled */
-#define FPRS_DU 0x2 /* lower unit dirty */
-#define FPRS_DL 0x1 /* upper unit dirty */
-
-ENTRY(_thread_machdep_fpsave)
- rd %fprs, %o1
- stx %o1, [%o0]
- andcc %o1, FPRS_ENA, %g0
- bz 1f
- nop
-
- stx %fsr, [%o0 + 8]
- add %o0, 16, %o0
-
- std %f0, [%o0 + 0 * 8] /* store registers */
- std %f2, [%o0 + 1 * 8]
- std %f4, [%o0 + 2 * 8]
- std %f6, [%o0 + 3 * 8]
- std %f8, [%o0 + 4 * 8]
- std %f10, [%o0 + 5 * 8]
- std %f12, [%o0 + 6 * 8]
- std %f14, [%o0 + 7 * 8]
- std %f16, [%o0 + 8 * 8]
- std %f18, [%o0 + 9 * 8]
- std %f20, [%o0 + 10 * 8]
- std %f22, [%o0 + 11 * 8]
- std %f24, [%o0 + 12 * 8]
- std %f26, [%o0 + 13 * 8]
- std %f28, [%o0 + 14 * 8]
- std %f30, [%o0 + 15 * 8]
-
- std %f32, [%o0 + 16 * 8] /* store registers */
- std %f34, [%o0 + 17 * 8]
- std %f36, [%o0 + 18 * 8]
- std %f38, [%o0 + 19 * 8]
- std %f40, [%o0 + 20 * 8]
- std %f42, [%o0 + 21 * 8]
- std %f44, [%o0 + 22 * 8]
- std %f46, [%o0 + 23 * 8]
- std %f48, [%o0 + 24 * 8]
- std %f50, [%o0 + 25 * 8]
- std %f52, [%o0 + 26 * 8]
- std %f54, [%o0 + 27 * 8]
- std %f56, [%o0 + 28 * 8]
- std %f58, [%o0 + 29 * 8]
- std %f60, [%o0 + 30 * 8]
- std %f62, [%o0 + 31 * 8]
-
- /* disable fpu and mark both sides clean */
- wr %g0, 0, %fprs
-
-1:
- retl
- nop
-
-ENTRY(_thread_machdep_fprestore)
- ldx [%o0], %o1 /* o1 = fprs */
- andcc %o1, FPRS_ENA, %g0
- bz 1f
- nop
-
- wr %o1, 0, %fprs
- ldx [%o0 + 8], %fsr
- add %o0, 16, %o0
-
- ldd [%o0 + 0 * 8], %f0
- ldd [%o0 + 1 * 8], %f2
- ldd [%o0 + 2 * 8], %f4
- ldd [%o0 + 3 * 8], %f6
- ldd [%o0 + 4 * 8], %f8
- ldd [%o0 + 5 * 8], %f10
- ldd [%o0 + 6 * 8], %f12
- ldd [%o0 + 7 * 8], %f14
- ldd [%o0 + 8 * 8], %f16
- ldd [%o0 + 9 * 8], %f18
- ldd [%o0 + 10 * 8], %f20
- ldd [%o0 + 11 * 8], %f22
- ldd [%o0 + 12 * 8], %f24
- ldd [%o0 + 13 * 8], %f26
- ldd [%o0 + 14 * 8], %f28
- ldd [%o0 + 15 * 8], %f30
-
- ldd [%o0 + 16 * 8], %f32
- ldd [%o0 + 17 * 8], %f34
- ldd [%o0 + 18 * 8], %f36
- ldd [%o0 + 19 * 8], %f38
- ldd [%o0 + 20 * 8], %f40
- ldd [%o0 + 21 * 8], %f42
- ldd [%o0 + 22 * 8], %f44
- ldd [%o0 + 23 * 8], %f46
- ldd [%o0 + 24 * 8], %f48
- ldd [%o0 + 25 * 8], %f50
- ldd [%o0 + 26 * 8], %f52
- ldd [%o0 + 27 * 8], %f54
- ldd [%o0 + 28 * 8], %f56
- ldd [%o0 + 29 * 8], %f58
- ldd [%o0 + 30 * 8], %f60
- ldd [%o0 + 31 * 8], %f62
-1:
- retl
- nop