0.9.3.63:
[sbcl.git] / src / runtime / x86-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 #include "validate.h"
22 #ifdef LISP_FEATURE_SB_THREAD
23 #error "Define threading support functions"
24 #else
25 int arch_os_thread_init(struct thread *thread) {
26   stack_t sigstack;
27 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
28     /* Signal handlers are run on the control stack, so if it is exhausted
29      * we had better use an alternate stack for whatever signal tells us
30      * we've exhausted it */
31     sigstack.ss_sp=((void *) thread)+dynamic_values_bytes;
32     sigstack.ss_flags=0;
33     sigstack.ss_size = 32*SIGSTKSZ;
34     sigaltstack(&sigstack,0);
35 #endif
36      return 1;                   /* success */
37 }
38 int arch_os_thread_cleanup(struct thread *thread) {
39     return 1;                   /* success */
40 }
41 #endif
42
43 os_context_register_t   *
44 os_context_register_addr(os_context_t *context, int offset)
45 {
46     switch(offset) {
47     case reg_EAX: return &context->uc_mcontext.gregs[11];
48     case reg_ECX: return &context->uc_mcontext.gregs[10];
49     case reg_EDX: return &context->uc_mcontext.gregs[9];
50     case reg_EBX: return &context->uc_mcontext.gregs[8];
51     case reg_ESP: return &context->uc_mcontext.gregs[7];
52     case reg_EBP: return &context->uc_mcontext.gregs[6];
53     case reg_ESI: return &context->uc_mcontext.gregs[5];
54     case reg_EDI: return &context->uc_mcontext.gregs[4];
55     default: return 0;
56     }
57     return &context->uc_mcontext.gregs[offset];
58 }
59
60 os_context_register_t *
61 os_context_pc_addr(os_context_t *context)
62 {
63     return &(context->uc_mcontext.gregs[14]); /* REG_EIP */
64 }
65
66 os_context_register_t *
67 os_context_sp_addr(os_context_t *context)
68 {
69     return &(context->uc_mcontext.gregs[17]); /* REG_UESP */
70 }
71
72 sigset_t *
73 os_context_sigmask_addr(os_context_t *context)
74 {
75     return &(context->uc_sigmask);
76 }
77
78 void os_flush_icache(os_vm_address_t address, os_vm_size_t length)
79 {
80 }