6 /* KLUDGE: There is strong family resemblance in the signal context
7 * stuff in FreeBSD and OpenBSD, but in detail they're different in
8 * almost every line of code. It would be nice to find some way to
9 * factor out the commonality better; failing that, it might be best
10 * just to split this generic-BSD code into one variant for each BSD.
12 * KLUDGE II: this split has begun with the addition of the Darwin BSD
13 * flavour, with the cross-architecture complications that this
14 * entails; unfortunately, currently the situation is worse, not
15 * better, than in the above paragraph. */
17 #if defined(__FreeBSD__) || defined(__OpenBSD__)
19 os_context_register_addr(os_context_t
*context
, int offset
)
23 return CONTEXT_ADDR_FROM_STEM(eax
);
25 return CONTEXT_ADDR_FROM_STEM(ecx
);
27 return CONTEXT_ADDR_FROM_STEM(edx
);
29 return CONTEXT_ADDR_FROM_STEM(ebx
);
31 return CONTEXT_ADDR_FROM_STEM(esp
);
33 return CONTEXT_ADDR_FROM_STEM(ebp
);
35 return CONTEXT_ADDR_FROM_STEM(esi
);
37 return CONTEXT_ADDR_FROM_STEM(edi
);
44 os_context_sp_addr(os_context_t
*context
)
46 return CONTEXT_ADDR_FROM_STEM(esp
);
49 #endif /* __FreeBSD__ || __OpenBSD__ */
53 os_context_register_addr(os_context_t
*context
, int offset
)
57 return CONTEXT_ADDR_FROM_STEM(EAX
);
59 return CONTEXT_ADDR_FROM_STEM(ECX
);
61 return CONTEXT_ADDR_FROM_STEM(EDX
);
63 return CONTEXT_ADDR_FROM_STEM(EBX
);
65 return CONTEXT_ADDR_FROM_STEM(ESP
);
67 return CONTEXT_ADDR_FROM_STEM(EBP
);
69 return CONTEXT_ADDR_FROM_STEM(ESI
);
71 return CONTEXT_ADDR_FROM_STEM(EDI
);
73 return CONTEXT_ADDR_FROM_STEM(UESP
);
80 os_context_sp_addr(os_context_t
*context
)
82 return &(_UC_MACHINE_SP(context
));
85 #endif /* __NetBSD__ */
89 /* FIXME: If this can be a no-op on BSD/x86, then it
90 * deserves a more precise name.
92 * (Perhaps os_prepare_data_area_to_be_executed()?) */
94 os_flush_icache(os_vm_address_t address
, os_vm_size_t length
)