Add :application-type parameter for save-lisp-and-die on Windows.
[sbcl.git] / src / runtime / mips-linux-os.c
index 17450af..70f988e 100644 (file)
 /* for cacheflush() */
 #include <sys/cachectl.h>
 
-/* for BD_CAUSE */
-#include <asm/mipsregs.h>
-
 #include "sbcl.h"
 #include "os.h"
 #include "arch.h"
 
+#define CAUSEF_BD (1 << 31)
+
 size_t os_vm_page_size;
 
 int
@@ -50,20 +49,26 @@ arch_os_thread_cleanup(struct thread *thread)
 os_context_register_t *
 os_context_register_addr(os_context_t *context, int offset)
 {
-    return &(((struct sigcontext *)&(context->uc_mcontext))->sc_regs[offset]);
+    mcontext_t *mctx = &context->uc_mcontext;
+    struct sigcontext *ctx = (struct sigcontext *)mctx;
+    return &ctx->sc_regs[offset];
 }
 
 os_context_register_t *
 os_context_fpregister_addr(os_context_t *context, int offset)
 {
-    return &(((struct sigcontext *)&(context->uc_mcontext))->sc_fpregs[offset]);
+    mcontext_t *mctx = &context->uc_mcontext;
+    struct sigcontext *ctx = (struct sigcontext *)mctx;
+    return &ctx->sc_fpregs[offset];
 }
 
 os_context_register_t *
 os_context_pc_addr(os_context_t *context)
 {
     /* Why do I get all the silly ports? -- CSR, 2002-08-11 */
-    return &(((struct sigcontext *)&(context->uc_mcontext))->sc_pc);
+    mcontext_t *mctx = &context->uc_mcontext;
+    struct sigcontext *ctx = (struct sigcontext *)mctx;
+    return &ctx->sc_pc;
 }
 
 sigset_t *
@@ -75,14 +80,17 @@ os_context_sigmask_addr(os_context_t *context)
 unsigned int
 os_context_fp_control(os_context_t *context)
 {
-    /* FIXME: Probably do something. */
-    return 0;
+    mcontext_t *mctx = &context->uc_mcontext;
+    struct sigcontext *ctx = (struct sigcontext *)mctx;
+    return ctx->sc_fpc_csr;
 }
 
 void
 os_restore_fp_control(os_context_t *context)
 {
-    /* FIXME: Probably do something. */
+    unsigned int ctl = os_context_fp_control(context);
+    ctl &= ~(FLOAT_STICKY_BITS_MASK | FLOAT_EXCEPTIONS_BYTE_MASK);
+    arch_set_fp_control(ctl);
 }
 
 unsigned int