0.9.13.4:
[sbcl.git] / src / runtime / ppc-darwin-os.c
1 /*
2  * This is the PowerPC/Darwin incarnation of arch-dependent
3  * OS-dependent routines. See also "bsdos.c".
4  */
5
6 /*
7  * This software is part of the SBCL system. See the README file for
8  * more information.
9  *
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.
15  */
16
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 "bsd-os.h"
25
26 os_context_register_t   *
27 os_context_register_addr(os_context_t *context, int offset)
28 {
29     ppc_saved_state_t *state = &context->uc_mcontext->ss;
30     switch(offset) {
31     case 0:
32         return &state->r0;
33     case 1:
34         return &state->r1;
35     case 2:
36         return &state->r2;
37     case 3:
38         return &state->r3;
39     case 4:
40         return &state->r4;
41     case 5:
42         return &state->r5;
43     case 6:
44         return &state->r6;
45     case 7:
46         return &state->r7;
47     case 8:
48         return &state->r8;
49     case 9:
50         return &state->r9;
51     case 10:
52         return &state->r10;
53     case 11:
54         return &state->r11;
55     case 12:
56         return &state->r12;
57     case 13:
58         return &state->r13;
59     case 14:
60         return &state->r14;
61     case 15:
62         return &state->r15;
63     case 16:
64         return &state->r16;
65     case 17:
66         return &state->r17;
67     case 18:
68         return &state->r18;
69     case 19:
70         return &state->r19;
71     case 20:
72         return &state->r20;
73     case 21:
74         return &state->r21;
75     case 22:
76         return &state->r22;
77     case 23:
78         return &state->r23;
79     case 24:
80         return &state->r24;
81     case 25:
82         return &state->r25;
83     case 26:
84         return &state->r26;
85     case 27:
86         return &state->r27;
87     case 28:
88         return &state->r28;
89     case 29:
90         return &state->r29;
91     case 30:
92         return &state->r30;
93     case 31:
94         return &state->r31;
95     case 41:
96         /* PT_DAR */
97         return &context->uc_mcontext->es.dar;
98     case 42:
99         /* PT_DSISR */
100         return &context->uc_mcontext->es.dsisr;
101     }
102 }
103
104 os_context_register_t *
105 os_context_lr_addr(os_context_t *context)
106 {
107     return &context->uc_mcontext->ss.lr;
108 }
109
110 void
111 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
112 {
113     /* see ppc-arch.c */
114     ppc_flush_icache(address,length);
115 }
116