X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fx86-bsd-os.c;h=8baf11dce3c1c8d59bd89a714dd9d4e75889a456;hb=69ef68ba7393e3492c1b4a756d1140f71c2922bc;hp=e1771b410f374843c493655cb4aa26e7733faf99;hpb=d3cf65aa7dbdd4e179a93ff7c7d9f28bb21b9394;p=sbcl.git diff --git a/src/runtime/x86-bsd-os.c b/src/runtime/x86-bsd-os.c index e1771b4..8baf11d 100644 --- a/src/runtime/x86-bsd-os.c +++ b/src/runtime/x86-bsd-os.c @@ -1,4 +1,5 @@ #include +#include "sbcl.h" #include "runtime.h" #include "target-os.h" @@ -12,7 +13,8 @@ * flavour, with the cross-architecture complications that this * entails; unfortunately, currently the situation is worse, not * better, than in the above paragraph. */ - + +#if defined(__FreeBSD__) || defined(__OpenBSD__) int * os_context_register_addr(os_context_t *context, int offset) { @@ -44,6 +46,45 @@ os_context_sp_addr(os_context_t *context) return CONTEXT_ADDR_FROM_STEM(esp); } +#endif /* __FreeBSD__ || __OpenBSD__ */ + +#ifdef __NetBSD__ +int * +os_context_register_addr(os_context_t *context, int offset) +{ + switch(offset) { + case 0: + return CONTEXT_ADDR_FROM_STEM(EAX); + case 2: + return CONTEXT_ADDR_FROM_STEM(ECX); + case 4: + return CONTEXT_ADDR_FROM_STEM(EDX); + case 6: + return CONTEXT_ADDR_FROM_STEM(EBX); + case 8: + return CONTEXT_ADDR_FROM_STEM(ESP); + case 10: + return CONTEXT_ADDR_FROM_STEM(EBP); + case 12: + return CONTEXT_ADDR_FROM_STEM(ESI); + case 14: + return CONTEXT_ADDR_FROM_STEM(EDI); + case 16: + return CONTEXT_ADDR_FROM_STEM(UESP); + default: + return 0; + } +} + +int * +os_context_sp_addr(os_context_t *context) +{ + return &(_UC_MACHINE_SP(context)); +} + +#endif /* __NetBSD__ */ + + /* FIXME: If this can be a no-op on BSD/x86, then it * deserves a more precise name.