Fix grammar in lossage message
[sbcl.git] / src / runtime / ppc-darwin-os.c
blob46c9ef0ac35e592ae4af4ca90297d9e823260ba2
1 /*
2 * This is the PowerPC/Darwin incarnation of arch-dependent
3 * OS-dependent routines. See also "bsdos.c".
4 */
6 /*
7 * This software is part of the SBCL system. See the README file for
8 * more information.
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.
17 #include "sbcl.h"
18 #include "globals.h"
19 #include "runtime.h"
20 #include <signal.h>
21 #include <ucontext.h>
22 #include <limits.h>
23 #include <mach-o/dyld.h>
24 #include "arch.h"
25 #include "interr.h" /* for declaration of lose */
27 #ifdef LISP_FEATURE_SB_THREAD
28 #error "Define threading support functions"
29 #else
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 */
36 #endif
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);
42 switch(offset) {
43 case 0:
44 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r0);
45 case 1:
46 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r1);
47 case 2:
48 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r2);
49 case 3:
50 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r3);
51 case 4:
52 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r4);
53 case 5:
54 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r5);
55 case 6:
56 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r6);
57 case 7:
58 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r7);
59 case 8:
60 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r8);
61 case 9:
62 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r9);
63 case 10:
64 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r10);
65 case 11:
66 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r11);
67 case 12:
68 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r12);
69 case 13:
70 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r13);
71 case 14:
72 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r14);
73 case 15:
74 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r15);
75 case 16:
76 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r16);
77 case 17:
78 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r17);
79 case 18:
80 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r18);
81 case 19:
82 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r19);
83 case 20:
84 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r20);
85 case 21:
86 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r21);
87 case 22:
88 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r22);
89 case 23:
90 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r23);
91 case 24:
92 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r24);
93 case 25:
94 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r25);
95 case 26:
96 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r26);
97 case 27:
98 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r27);
99 case 28:
100 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r28);
101 case 29:
102 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r29);
103 case 30:
104 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r30);
105 case 31:
106 return (os_context_register_t *) &state->PPC_DARWIN_REGIFY(r31);
107 case 41:
108 /* PT_DAR */
109 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(es).PPC_DARWIN_REGIFY(dar);
110 case 42:
111 /* PT_DSISR */
112 return (os_context_register_t *) &context->uc_mcontext->PPC_DARWIN_REGIFY(es).PPC_DARWIN_REGIFY(dsisr);
113 default:
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);
142 void
143 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
145 /* see ppc-arch.c */
146 ppc_flush_icache(address,length);