0.8.2.12:
[sbcl.git] / src / runtime / x86-bsd-os.c
1 #include <signal.h>
2 #include "target-os.h"
3
4 /* KLUDGE: There is strong family resemblance in the signal context
5  * stuff in FreeBSD and OpenBSD, but in detail they're different in
6  * almost every line of code. It would be nice to find some way to
7  * factor out the commonality better; failing that, it might be best
8  * just to split this generic-BSD code into one variant for each BSD. 
9  *
10  * KLUDGE II: this split has begun with the addition of the Darwin BSD
11  * flavour, with the cross-architecture complications that this
12  * entails; unfortunately, currently the situation is worse, not
13  * better, than in the above paragraph. */
14    
15 int *
16 os_context_register_addr(os_context_t *context, int offset)
17 {
18     switch(offset) {
19     case  0:
20         return CONTEXT_ADDR_FROM_STEM(eax);
21     case  2:
22         return CONTEXT_ADDR_FROM_STEM(ecx);
23     case  4:
24         return CONTEXT_ADDR_FROM_STEM(edx);
25     case  6:
26         return CONTEXT_ADDR_FROM_STEM(ebx);
27     case  8:
28         return CONTEXT_ADDR_FROM_STEM(esp);
29     case 10:
30         return CONTEXT_ADDR_FROM_STEM(ebp);
31     case 12:
32         return CONTEXT_ADDR_FROM_STEM(esi);
33     case 14:
34         return CONTEXT_ADDR_FROM_STEM(edi);
35     default:
36         return 0;
37     }
38 }
39
40 int *
41 os_context_sp_addr(os_context_t *context)
42 {
43     return CONTEXT_ADDR_FROM_STEM(esp);
44 }
45
46
47 /* FIXME: If this can be a no-op on BSD/x86, then it 
48  * deserves a more precise name.
49  *
50  * (Perhaps os_prepare_data_area_to_be_executed()?) */
51 void
52 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
53 {
54 }