summaryrefslogtreecommitdiff
path: root/lib/libpthread/arch
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-01-26 20:24:37 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-01-26 20:24:37 +0000
commitbb731899ef141d461ac99d7cb6737a4c732983c0 (patch)
tree20c622334cbc6b18cd4758d37f885df5fdb73634 /lib/libpthread/arch
parent04edeb1d87fd72cdeb04200381eddf62c9f30c2e (diff)
save fpu context (needs optimization)
Diffstat (limited to 'lib/libpthread/arch')
-rw-r--r--lib/libpthread/arch/sparc/uthread_machdep.c5
-rw-r--r--lib/libpthread/arch/sparc/uthread_machdep.h10
-rw-r--r--lib/libpthread/arch/sparc/uthread_machdep_asm.S49
3 files changed, 59 insertions, 5 deletions
diff --git a/lib/libpthread/arch/sparc/uthread_machdep.c b/lib/libpthread/arch/sparc/uthread_machdep.c
index 789a1d3efd1..006fb9f4aa5 100644
--- a/lib/libpthread/arch/sparc/uthread_machdep.c
+++ b/lib/libpthread/arch/sparc/uthread_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_machdep.c,v 1.1 2000/09/25 01:16:40 d Exp $ */
+/* $OpenBSD: uthread_machdep.c,v 1.2 2003/01/26 20:24:36 jason Exp $ */
/*
* Machine-dependent thread state functions for OpenBSD/sparc.
@@ -35,6 +35,9 @@ void
_thread_machdep_save_float_state(statep)
struct _machdep_state* statep;
{
+ u_int32_t zero = 0;
+
+ _thread_machdep_fpsave(&statep->fs_csr, &statep->fs_regs[0], &zero);
}
void
diff --git a/lib/libpthread/arch/sparc/uthread_machdep.h b/lib/libpthread/arch/sparc/uthread_machdep.h
index cb43f3a0463..087d47de53d 100644
--- a/lib/libpthread/arch/sparc/uthread_machdep.h
+++ b/lib/libpthread/arch/sparc/uthread_machdep.h
@@ -1,7 +1,11 @@
-/* $OpenBSD: uthread_machdep.h,v 1.5 2000/10/04 05:55:35 d Exp $ */
+/* $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 */
+ 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
index f7a81f99b08..760c6d226f3 100644
--- a/lib/libpthread/arch/sparc/uthread_machdep_asm.S
+++ b/lib/libpthread/arch/sparc/uthread_machdep_asm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_machdep_asm.S,v 1.5 2001/12/18 06:24:13 fgsch Exp $ */
+/* $OpenBSD: uthread_machdep_asm.S,v 1.6 2003/01/26 20:24:36 jason Exp $ */
/* David Leonard <d@csee.uq.edu.au>. Public domain. */
#include <machine/asm.h>
@@ -40,3 +40,50 @@ ENTRY(_thread_machdep_switch)
ret
restore
+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
+ * priviledged instruction.
+ */
+
+ /* save registers */
+ 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
+
+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
+ retl
+ nop