fix bug in SYMBOL-VALUE CAS expansion for constant arguments
[sbcl.git] / src / runtime / x86-64-sunos-os.c
1 #include <stdio.h>
2 #include <sys/param.h>
3 #include <sys/file.h>
4 #include "sbcl.h"
5 #include "./signal.h"
6 #include "os.h"
7 #include "arch.h"
8 #include "globals.h"
9 #include "interrupt.h"
10 #include "interr.h"
11 #include "lispregs.h"
12 #include <sys/socket.h>
13 #include <sys/utsname.h>
14
15 #include <sys/types.h>
16 #include <signal.h>
17 #include <sys/time.h>
18 #include <sys/stat.h>
19 #include <unistd.h>
20
21 #ifdef LISP_FEATURE_SB_THREAD
22 #error "Threading is not supported for Solaris running on x86-64."
23 #endif
24
25 #include "validate.h"
26
27
28 int arch_os_thread_init(struct thread *thread) {
29   stack_t sigstack;
30      return 1;
31 }
32
33 int arch_os_thread_cleanup(struct thread *thread) {
34     return 1;
35 }
36
37
38 os_context_register_t *
39 os_context_register_addr(os_context_t *context, int offset)
40 {
41 #define RCASE(name) case reg_ ## name: return &context->uc_mcontext.gregs[REG_ ## name];
42     switch(offset) {
43         RCASE(RAX)
44         RCASE(RCX)
45         RCASE(RDX)
46         RCASE(RBX)
47         RCASE(RSP)
48         RCASE(RBP)
49         RCASE(RSI)
50         RCASE(RDI)
51         RCASE(R8)
52         RCASE(R9)
53         RCASE(R10)
54         RCASE(R11)
55         RCASE(R12)
56         RCASE(R13)
57         RCASE(R14)
58         RCASE(R15)
59       default:
60         if(offset<NGREG)
61             return &context->uc_mcontext.gregs[offset/2+4];
62         else return 0;
63     }
64     return &context->uc_mcontext.gregs[offset];
65 }
66
67 os_context_register_t *
68 os_context_pc_addr(os_context_t *context)
69 {
70     return &context->uc_mcontext.gregs[REG_RIP];
71 }
72
73 os_context_register_t *
74 os_context_sp_addr(os_context_t *context)
75 {
76     return &context->uc_mcontext.gregs[REG_RSP];
77 }
78
79 sigset_t *
80 os_context_sigmask_addr(os_context_t *context)
81 {
82     return &(context->uc_sigmask);
83 }
84
85 void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
86 {
87 }
88
89 unsigned long
90 os_context_fp_control(os_context_t *context)
91 {
92   return context->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw;
93 }