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.
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. */
16 #if defined(__FreeBSD__) || defined(__OpenBSD__)
18 os_context_register_addr(os_context_t *context, int offset)
22 return CONTEXT_ADDR_FROM_STEM(eax);
24 return CONTEXT_ADDR_FROM_STEM(ecx);
26 return CONTEXT_ADDR_FROM_STEM(edx);
28 return CONTEXT_ADDR_FROM_STEM(ebx);
30 return CONTEXT_ADDR_FROM_STEM(esp);
32 return CONTEXT_ADDR_FROM_STEM(ebp);
34 return CONTEXT_ADDR_FROM_STEM(esi);
36 return CONTEXT_ADDR_FROM_STEM(edi);
43 os_context_sp_addr(os_context_t *context)
45 return CONTEXT_ADDR_FROM_STEM(esp);
48 #endif /* __FreeBSD__ || __OpenBSD__ */
52 os_context_register_addr(os_context_t *context, int offset)
56 return CONTEXT_ADDR_FROM_STEM(EAX);
58 return CONTEXT_ADDR_FROM_STEM(ECX);
60 return CONTEXT_ADDR_FROM_STEM(EDX);
62 return CONTEXT_ADDR_FROM_STEM(EBX);
64 return CONTEXT_ADDR_FROM_STEM(ESP);
66 return CONTEXT_ADDR_FROM_STEM(EBP);
68 return CONTEXT_ADDR_FROM_STEM(ESI);
70 return CONTEXT_ADDR_FROM_STEM(EDI);
77 os_context_sp_addr(os_context_t *context)
79 return &(_UC_MACHINE_SP(context));
82 #endif /* __NetBSD__ */
86 /* FIXME: If this can be a no-op on BSD/x86, then it
87 * deserves a more precise name.
89 * (Perhaps os_prepare_data_area_to_be_executed()?) */
91 os_flush_icache(os_vm_address_t address, os_vm_size_t length)