2 * This is the PowerPC/Darwin incarnation of arch-dependent
3 * OS-dependent routines. See also "bsdos.c".
7 * This software is part of the SBCL system. See the README file for
10 * This software is derived from the CMU CL system, which was
11 * written at Carnegie Mellon University and released into the
12 * public domain. The software is in the public domain and is
13 * provided with absolutely no warranty. See the COPYING and CREDITS
14 * files for more information.
23 #include <mach-o/dyld.h>
25 #include "interr.h" /* for declaration of lose */
27 #ifdef LISP_FEATURE_SB_THREAD
28 #error "Define threading support functions"
30 int arch_os_thread_init(struct thread *thread) {
31 return 1; /* success */
33 int arch_os_thread_cleanup(struct thread *thread) {
34 return 1; /* success */
38 os_context_register_t *
39 os_context_register_addr(os_context_t *context, int offset)
41 ppc_ss_struct_t *state = &context->uc_mcontext->PPC_DARWIN_REGIFY(ss);
44 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r0);
46 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r1);
48 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r2);
50 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r3);
52 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r4);
54 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r5);
56 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r6);
58 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r7);
60 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r8);
62 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r9);
64 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r10);
66 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r11);
68 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r12);
70 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r13);
72 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r14);
74 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r15);
76 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r16);
78 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r17);
80 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r18);
82 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r19);
84 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r20);
86 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r21);
88 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r22);
90 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r23);
92 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r24);
94 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r25);
96 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r26);
98 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r27);
100 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r28);
102 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r29);
104 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r30);
106 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r31);
109 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(es).PPC_DARWIN_REGIFY(dar);
112 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(es).PPC_DARWIN_REGIFY(dsisr);
114 lose("bad offset to os_context_register_addr");
118 os_context_register_t *
119 os_context_lr_addr(os_context_t *context)
121 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(ss).PPC_DARWIN_REGIFY(lr);
124 os_context_register_t *
125 os_context_ctr_addr(os_context_t *context)
127 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(ss).PPC_DARWIN_REGIFY(ctr);
130 os_context_register_t *
131 os_context_cr_addr(os_context_t *context)
133 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(ss).PPC_DARWIN_REGIFY(cr);
136 os_context_register_t *
137 os_context_pc_addr(os_context_t *context)
139 return &context->uc_mcontext->PPC_DARWIN_REGIFY(ss).PPC_DARWIN_REGIFY(srr0);
143 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
146 ppc_flush_icache(address,length);