diff options
Diffstat (limited to 'lib/libpthread/arch')
-rw-r--r-- | lib/libpthread/arch/alpha/uthread_machdep.h | 7 | ||||
-rw-r--r-- | lib/libpthread/arch/hppa/uthread_machdep.h | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/uthread_machdep.h | 92 | ||||
-rw-r--r-- | lib/libpthread/arch/m68k/uthread_machdep.h | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/mips/uthread_machdep.h | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/powerpc/uthread_machdep.h | 4 | ||||
-rw-r--r-- | lib/libpthread/arch/sparc/uthread_machdep.h | 4 |
7 files changed, 91 insertions, 28 deletions
diff --git a/lib/libpthread/arch/alpha/uthread_machdep.h b/lib/libpthread/arch/alpha/uthread_machdep.h index 3c8ea0489b1..b9cf839f6bd 100644 --- a/lib/libpthread/arch/alpha/uthread_machdep.h +++ b/lib/libpthread/arch/alpha/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/alpha machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.1 1998/08/28 01:54:57 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.2 1999/01/17 23:49:48 d Exp $ */ /* save the floating point state of a thread */ @@ -31,6 +31,11 @@ - sizeof(double); \ } +#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]; }; diff --git a/lib/libpthread/arch/hppa/uthread_machdep.h b/lib/libpthread/arch/hppa/uthread_machdep.h index 161283978ee..773bd90e22f 100644 --- a/lib/libpthread/arch/hppa/uthread_machdep.h +++ b/lib/libpthread/arch/hppa/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/hppa machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.1 1998/12/21 22:54:56 mickey Exp $$ + * $OpenBSD: uthread_machdep.h,v 1.2 1999/01/17 23:49:48 d Exp $$ */ /* save the floating point state of a thread */ @@ -31,6 +31,8 @@ #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]; */ int dummy; diff --git a/lib/libpthread/arch/i386/uthread_machdep.h b/lib/libpthread/arch/i386/uthread_machdep.h index 652f32d4285..6e6e83b850c 100644 --- a/lib/libpthread/arch/i386/uthread_machdep.h +++ b/lib/libpthread/arch/i386/uthread_machdep.h @@ -1,40 +1,88 @@ /* * OpenBSD/i386 machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.3 1999/01/10 22:59:33 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.4 1999/01/17 23:49:49 d Exp $ */ #include <machine/reg.h> -/* save the floating point state of a thread */ -#define _thread_machdep_save_float_state(thr) \ - { \ +/* + * We need to extend jmp_buf to hold extended segment registers + * for WINE. + */ +typedef struct _machdep_jmp_buf { + union { + jmp_buf jb; + struct { + int eip; + int ebx; + int esp; + int ebp; + int esi; + int edi; + } jbs; + } u; +#define mjb_eip u.jbs.eip +#define mjb_ebx u.jbs.ebx +#define mjb_esp u.jbs.esp +#define mjb_ebp u.jbs.ebp +#define mjb_esi u.jbs.esi +#define mjb_edi u.jbs.edi + int mjb_ds; /* informational only - not restored */ + int mjb_es; /* informational only - not restored */ + int mjb_fs; + int mjb_gs; +} _machdep_jmp_buf; + +/* Extra machine-dependent information */ +struct _machdep_struct { + struct fpreg saved_fp; /* only saved with on signals */ +}; + +/* 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)); \ + __asm__("fsave %0"::"m" (*fdata)); \ } -/* restore the floating point state of a thread */ -#define _thread_machdep_restore_float_state(thr) \ - { \ +/* 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)); \ + __asm__("frstor %0"::"m" (*fdata)); \ } -/* initialise the jmpbuf stack frame so it continues from entry */ +/* Initialise the jmpbuf stack frame so it continues from entry: */ #define _thread_machdep_thread_create(thr, entry, pattr) \ - { \ - /* entry */ \ - (thr)->saved_jmp_buf[0] = (long) entry; \ - /* stack */ \ - (thr)->saved_jmp_buf[2] = (long) (thr)->stack \ - + (pattr)->stacksize_attr \ - - sizeof(double); \ + { \ + /* entry */ \ + (thr)->saved_jmp_buf.mjb_eip = (long) entry; \ + /* stack */ \ + (thr)->saved_jmp_buf.mjb_esp = (long) (thr)->stack \ + + (pattr)->stacksize_attr \ + - sizeof(double); \ } -#define _thread_machdep_longjmp(a,v) longjmp(a,v) -#define _thread_machdep_setjmp(a) setjmp(a) +static __inline int +_thread_machdep_setjmp_helper(a) + _machdep_jmp_buf *a; +{ + int v; -struct _machdep_struct { - struct fpreg saved_fp; -}; + __asm__("mov %%ds, %0\n" : "=m" (a->mjb_ds) ); + __asm__("mov %%es, %0\n" : "=m" (a->mjb_es) ); + __asm__("mov %%fs, %0\n" : "=m" (a->mjb_fs) ); + __asm__("mov %%gs, %0\n" : "=m" (a->mjb_gs) ); + v = setjmp(a->u.jb); + if (v) { + __asm__("mov %0, %%gs\n" :: "m" (a->mjb_gs) ); + __asm__("mov %0, %%fs\n" :: "m" (a->mjb_fs) ); + /* __asm__("mov %0, %%es\n" :: "m" (a->mjb_es) ); */ + /* __asm__("mov %0, %%ds\n" :: "m" (a->mjb_ds) ); */ + } + return (v); +} +#define _thread_machdep_longjmp(a,v) longjmp((a).u.jb,v) +#define _thread_machdep_setjmp(a) _thread_machdep_setjmp_helper(&(a)) diff --git a/lib/libpthread/arch/m68k/uthread_machdep.h b/lib/libpthread/arch/m68k/uthread_machdep.h index 3df12262e28..4ed702981b5 100644 --- a/lib/libpthread/arch/m68k/uthread_machdep.h +++ b/lib/libpthread/arch/m68k/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/m68k machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.1 1998/11/20 11:15:36 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.2 1999/01/17 23:49:49 d Exp $ */ /* save the floating point state of a thread */ @@ -31,6 +31,8 @@ #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]; */ int dummy; diff --git a/lib/libpthread/arch/mips/uthread_machdep.h b/lib/libpthread/arch/mips/uthread_machdep.h index 0470a810663..6052b2003da 100644 --- a/lib/libpthread/arch/mips/uthread_machdep.h +++ b/lib/libpthread/arch/mips/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/mips machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.2 1998/11/20 11:15:37 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.3 1999/01/17 23:49:49 d Exp $ */ #include <machine/regnum.h> @@ -31,6 +31,8 @@ #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 { /* nothing needed */ }; diff --git a/lib/libpthread/arch/powerpc/uthread_machdep.h b/lib/libpthread/arch/powerpc/uthread_machdep.h index 3ba790a49c2..3da9b3e0ddf 100644 --- a/lib/libpthread/arch/powerpc/uthread_machdep.h +++ b/lib/libpthread/arch/powerpc/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/powerpc machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.1 1998/12/21 07:22:26 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.2 1999/01/17 23:49:49 d Exp $ */ /* save the floating point state of a thread */ @@ -25,6 +25,8 @@ #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 xxx; }; diff --git a/lib/libpthread/arch/sparc/uthread_machdep.h b/lib/libpthread/arch/sparc/uthread_machdep.h index 56103122674..c922b49fd0c 100644 --- a/lib/libpthread/arch/sparc/uthread_machdep.h +++ b/lib/libpthread/arch/sparc/uthread_machdep.h @@ -1,7 +1,7 @@ /* * OpenBSD/sparc machine-dependent thread macros * - * $OpenBSD: uthread_machdep.h,v 1.1 1998/11/20 11:15:37 d Exp $ + * $OpenBSD: uthread_machdep.h,v 1.2 1999/01/17 23:49:49 d Exp $ */ #include <sys/signal.h> @@ -38,6 +38,8 @@ #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[???]; */ int dummy; |