Better checking of package locks when declaring variables.
[sbcl.git] / src / runtime / ppc-bsd-os.c
blobc71912d0c3b26eca7da836aa5874796525abad03
1 #include <signal.h>
2 #include <machine/cpu.h>
3 #include "sbcl.h"
4 #include "runtime.h"
5 #include "thread.h"
8 int *
9 os_context_register_addr(os_context_t *context, int offset)
11 #if defined(LISP_FEATURE_NETBSD)
12 return &context->uc_mcontext.__gregs[offset];
13 #elif defined(LISP_FEATURE_OPENBSD)
14 return &context->sc_frame.fixreg[offset];
15 #endif
18 #if defined(ARCH_HAS_STACK_POINTER) /* It's not defined on PPC. */
19 int *
20 os_context_sp_addr(os_context_t *context)
22 #if defined(LISP_FEATURE_NETBSD)
23 return &(_UC_MACHINE_SP(context));
24 #endif
26 #endif
29 int *
30 os_context_pc_addr(os_context_t *context)
32 #if defined(LISP_FEATURE_NETBSD)
33 return &(_UC_MACHINE_PC(context));
34 #elif defined(LISP_FEATURE_OPENBSD)
35 return &context->sc_frame.srr0;
36 #endif
39 int *
40 os_context_lr_addr(os_context_t *context)
42 #if defined(LISP_FEATURE_NETBSD)
43 return &context->uc_mcontext.__gregs[_REG_LR];
44 #elif defined(LISP_FEATURE_OPENBSD)
45 return &context->sc_frame.lr;
46 #endif
49 os_context_register_t *
50 os_context_ctr_addr(os_context_t *context)
52 #if defined(LISP_FEATURE_NETBSD)
53 return &context->uc_mcontext.__gregs[_REG_CTR];
54 #elif defined(LISP_FEATURE_OPENBSD)
55 return &context->sc_frame.ctr;
56 #endif
59 os_context_register_t *
60 os_context_cr_addr(os_context_t *context)
62 #if defined(LISP_FEATURE_NETBSD)
63 return &context->uc_mcontext.__gregs[_REG_CR];
64 #elif defined(LISP_FEATURE_OPENBSD)
65 return &context->sc_frame.cr;
66 #endif
69 /* FIXME: If this can be a no-op on BSD/x86, then it
70 * deserves a more precise name.
72 * (Perhaps os_prepare_data_area_to_be_executed()?) */
73 void
74 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
76 ppc_flush_icache(address, length);
79 int arch_os_thread_init(struct thread *thread) {
81 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
82 stack_t sigstack;
84 /* Signal handlers are run on the control stack, so if it is exhausted
85 * we had better use an alternate stack for whatever signal tells us
86 * we've exhausted it */
87 sigstack.ss_sp=((void *) thread)+dynamic_values_bytes;
88 sigstack.ss_flags=0;
89 sigstack.ss_size = 32*SIGSTKSZ;
90 sigaltstack(&sigstack,0);
91 #endif
93 return 1; /* success */
96 int arch_os_thread_cleanup(struct thread *thread) {
98 return 1; /* success */