X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fx86-bsd-os.c;h=d071666d1077a3fda2e9fee0e1247c8c1d0c5ab4;hb=743831e679b673a5680a0afd8402911516bf50e2;hp=d493800f36f675089ba2296cd6aa96f1871f957e;hpb=9a19ce460a70a6c1de36095b3e2621116b91cc80;p=sbcl.git diff --git a/src/runtime/x86-bsd-os.c b/src/runtime/x86-bsd-os.c index d493800..d071666 100644 --- a/src/runtime/x86-bsd-os.c +++ b/src/runtime/x86-bsd-os.c @@ -19,6 +19,12 @@ #include "machine/npx.h" #endif +#if defined(LISP_FEATURE_OPENBSD) +#include +#include +#include +#endif + /* KLUDGE: There is strong family resemblance in the signal context * stuff in FreeBSD and OpenBSD, but in detail they're different in * almost every line of code. It would be nice to find some way to @@ -156,7 +162,7 @@ int arch_os_thread_init(struct thread *thread) { struct segment_descriptor ldt_entry = { 0, 0, SDT_MEMRW, SEL_UPL, 1, 0, 0, 1, 0, 0 }; - set_data_desc_addr(&ldt_entry, (unsigned long) thread); + set_data_desc_addr(&ldt_entry, thread); set_data_desc_size(&ldt_entry, dynamic_values_bytes); n = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor*) &ldt_entry, 1); @@ -226,8 +232,8 @@ os_restore_fp_control(os_context_t *context) * On earlier systems, it is shared in a whole process. */ #if defined(__FreeBSD_version) && __FreeBSD_version >= 500040 - struct envxmm *ex = (struct envxmm*)(&context->uc_mcontext.mc_fpstate); - asm ("fldcw %0" : : "m" (ex->en_cw)); + struct envxmm *ex = (struct envxmm *)(context->uc_mcontext.mc_fpstate); + __asm__ __volatile__ ("fldcw %0" : : "m" (ex->en_cw)); #endif #if defined(LISP_FEATURE_RESTORE_TLS_SEGMENT_REGISTER_FROM_CONTEXT) /* Calling this function here may not be good idea. Or rename @@ -237,3 +243,19 @@ os_restore_fp_control(os_context_t *context) #endif } #endif + +#if defined(LISP_FEATURE_OPENBSD) +void +os_restore_fp_control(os_context_t *context) +{ + struct sigframe *frame; + union savefpu *fpu; + + frame = (struct sigframe *)((char*)context - offsetof(struct sigframe, sf_sc)); + fpu = frame->sf_fpstate; + if (openbsd_use_fxsave) + __asm__ __volatile__ ("fldcw %0" : : "m" (fpu->sv_xmm.sv_env.en_cw)); + else + __asm__ __volatile__ ("fldcw %0" : : "m" (fpu->sv_87.sv_env.en_cw)); +} +#endif