From 70b264ca3912a138b1dce706ec66937350d4d279 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Thu, 4 Feb 1999 23:37:40 +0000 Subject: Save/restore the fp state setjmp/longjmp does not --- lib/libc_r/arch/alpha/uthread_machdep.h | 55 ++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 14 deletions(-) (limited to 'lib/libc_r/arch/alpha/uthread_machdep.h') diff --git a/lib/libc_r/arch/alpha/uthread_machdep.h b/lib/libc_r/arch/alpha/uthread_machdep.h index c64006640b8..7ee0653367d 100644 --- a/lib/libc_r/arch/alpha/uthread_machdep.h +++ b/lib/libc_r/arch/alpha/uthread_machdep.h @@ -1,22 +1,49 @@ /* * OpenBSD/alpha machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.3 1999/02/03 05:25:01 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.4 1999/02/04 23:37:39 niklas Exp $ */ /* save the floating point state of a thread */ -#define _thread_machdep_save_float_state(thr) \ - { \ -/* char *fdata = (char*)((thr)->_machdep.saved_fp); \ - __asm__("fsave %0"::"m" (*fdata)); */ \ - } +#define _thread_machdep_save_float_state(thr) \ +do { \ + __asm__( \ + "stt $f8, ( 0 * 8) + %0\n\tstt $f9, ( 1 * 8) + %0\n\t" \ + "stt $f10, ( 2 * 8) + %0\n\tstt $f11, ( 3 * 8) + %0\n\t" \ + "stt $f12, ( 4 * 8) + %0\n\tstt $f13, ( 5 * 8) + %0\n\t" \ + "stt $f14, ( 6 * 8) + %0\n\tstt $f15, ( 7 * 8) + %0\n\t" \ + "stt $f16, ( 8 * 8) + %0\n\tstt $f17, ( 9 * 8) + %0\n\t" \ + "stt $f18, (10 * 8) + %0\n\tstt $f19, (11 * 8) + %0\n\t" \ + "stt $f20, (12 * 8) + %0\n\tstt $f21, (13 * 8) + %0\n\t" \ + "stt $f22, (14 * 8) + %0\n\tstt $f23, (15 * 8) + %0\n\t" \ + "stt $f24, (16 * 8) + %0\n\tstt $f25, (17 * 8) + %0\n\t" \ + "stt $f26, (18 * 8) + %0\n\tstt $f27, (19 * 8) + %0\n\t" \ + "stt $f28, (20 * 8) + %0\n\tstt $f29, (21 * 8) + %0\n\t" \ + "stt $f30, (22 * 8) + %0" \ + : : "o" ((thr)->_machdep.saved_fp) : "memory"); \ +} while(0) /* restore the floating point state of a thread */ -#define _thread_machdep_restore_float_state(thr) \ - { \ -/* char *fdata = (char*)((thr)->_machdep.saved_fp); \ - __asm__("frstor %0"::"m" (*fdata)); */ \ - } +#define _thread_machdep_restore_float_state(thr) \ +do { \ + __asm__( \ + "ldt $f8, ( 0 * 8) + %0\n\tldt $f9, ( 1 * 8) + %0\n\t" \ + "ldt $f10, ( 2 * 8) + %0\n\tldt $f11, ( 3 * 8) + %0\n\t" \ + "ldt $f12, ( 4 * 8) + %0\n\tldt $f13, ( 5 * 8) + %0\n\t" \ + "ldt $f14, ( 6 * 8) + %0\n\tldt $f15, ( 7 * 8) + %0\n\t" \ + "ldt $f16, ( 8 * 8) + %0\n\tldt $f17, ( 9 * 8) + %0\n\t" \ + "ldt $f18, (10 * 8) + %0\n\tldt $f19, (11 * 8) + %0\n\t" \ + "ldt $f20, (12 * 8) + %0\n\tldt $f21, (13 * 8) + %0\n\t" \ + "ldt $f22, (14 * 8) + %0\n\tldt $f23, (15 * 8) + %0\n\t" \ + "ldt $f24, (16 * 8) + %0\n\tldt $f25, (17 * 8) + %0\n\t" \ + "ldt $f26, (18 * 8) + %0\n\tldt $f27, (19 * 8) + %0\n\t" \ + "ldt $f28, (20 * 8) + %0\n\tldt $f29, (21 * 8) + %0\n\t" \ + "ldt $f30, (22 * 8) + %0\n\t" \ + : : "o" (thr->_machdep.saved_fp) : \ + "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \ + "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", \ + "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30"); \ +} while(0) /* initialise the jmpbuf stack frame so it continues from entry */ #define _thread_machdep_thread_create(thr, entry, pattr) \ @@ -31,11 +58,11 @@ - sizeof(double); \ } -#define _thread_machdep_longjmp(a,v) longjmp(a,v) -#define _thread_machdep_setjmp(a) setjmp(a) +#define _thread_machdep_longjmp(a,v) _longjmp(a,v) +#define _thread_machdep_setjmp(a) _setjmp(a) typedef jmp_buf _machdep_jmp_buf; struct _machdep_struct { - char saved_fp[108]; + char saved_fp[23 * 8]; }; -- cgit v1.2.3