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