12 #include <sys/socket.h>
13 #include <sys/utsname.h>
15 #include <sys/types.h>
22 #ifdef LISP_FEATURE_SB_THREAD
23 #error "Define threading support functions"
25 int arch_os_thread_init(struct thread *thread) {
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;
33 sigstack.ss_size = 32*SIGSTKSZ;
34 sigaltstack(&sigstack,0);
36 return 1; /* success */
38 int arch_os_thread_cleanup(struct thread *thread) {
39 return 1; /* success */
43 os_context_register_t *
44 os_context_register_addr(os_context_t *context, int 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];
57 return &context->uc_mcontext.gregs[offset];
60 os_context_register_t *
61 os_context_pc_addr(os_context_t *context)
63 return &(context->uc_mcontext.gregs[14]); /* REG_EIP */
66 os_context_register_t *
67 os_context_sp_addr(os_context_t *context)
69 return &(context->uc_mcontext.gregs[17]); /* REG_UESP */
73 os_context_sigmask_addr(os_context_t *context)
75 return &(context->uc_sigmask);
78 void os_flush_icache(os_vm_address_t address, os_vm_size_t length)