diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2003-01-24 21:05:46 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2003-01-24 21:05:46 +0000 |
commit | 05fb1cdc6f700ca9680781b3e0df39ac65950b41 (patch) | |
tree | a6b4f37c678bd4735391b251425315eca05c9344 /lib | |
parent | c2d1f9d7206a0c18bda06f5221e4803b0c899249 (diff) |
Save FPU state (unconditionally)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libpthread/arch/sparc64/uthread_machdep.c | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc64/uthread_machdep.h | 10 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc64/uthread_machdep_asm.S | 91 |
3 files changed, 102 insertions, 3 deletions
diff --git a/lib/libpthread/arch/sparc64/uthread_machdep.c b/lib/libpthread/arch/sparc64/uthread_machdep.c index fc754003744..e76d475da43 100644 --- a/lib/libpthread/arch/sparc64/uthread_machdep.c +++ b/lib/libpthread/arch/sparc64/uthread_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_machdep.c,v 1.2 2002/01/02 19:12:43 art Exp $ */ +/* $OpenBSD: uthread_machdep.c,v 1.3 2003/01/24 21:05:45 jason Exp $ */ /* * Machine-dependent thread state functions for OpenBSD/sparc. @@ -36,10 +36,12 @@ 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 index 1343341f34e..4c746423983 100644 --- a/lib/libpthread/arch/sparc64/uthread_machdep.h +++ b/lib/libpthread/arch/sparc64/uthread_machdep.h @@ -1,7 +1,15 @@ -/* $OpenBSD: uthread_machdep.h,v 1.2 2002/01/02 19:11:13 art Exp $ */ +/* $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 index 774083a13af..7661fe6f313 100644 --- a/lib/libpthread/arch/sparc64/uthread_machdep_asm.S +++ b/lib/libpthread/arch/sparc64/uthread_machdep_asm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_machdep_asm.S,v 1.4 2002/08/25 22:10:44 brad Exp $ */ +/* $OpenBSD: uthread_machdep_asm.S,v 1.5 2003/01/24 21:05:45 jason Exp $ */ /* David Leonard <d@csee.uq.edu.au>. Public domain. */ #include <machine/asm.h> @@ -37,3 +37,92 @@ ENTRY(_thread_machdep_switch) 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] + 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] + + retl + nop + +ENTRY(_thread_machdep_fprestore) + ldx [%o0], %o1 /* o1 = fprs */ + 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 + + retl + nop |