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