X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fx86-bsd-os.h;h=5f1e242592a582712c608aa00ca1661ac0d01ef6;hb=c3699db2053ff3b5ac6a98d4431c3789496002d8;hp=1340cb49fd4dbcdea7c3fb220191746e63b1a819;hpb=503a50f07740b52908f630b0492cf56556f1a792;p=sbcl.git diff --git a/src/runtime/x86-bsd-os.h b/src/runtime/x86-bsd-os.h index 1340cb4..5f1e242 100644 --- a/src/runtime/x86-bsd-os.h +++ b/src/runtime/x86-bsd-os.h @@ -1,8 +1,20 @@ -#ifndef _X86_LINUX_OS_H -#define _X86_LINUX_OS_H +#ifndef _X86_BSD_OS_H +#define _X86_BSD_OS_H static inline os_context_t *arch_os_get_context(void **void_context) { return (os_context_t *) *void_context; } -#endif /* _X86_LINUX_OS_H */ +/* The different BSD variants have diverged in exactly where they + * store signal context information, but at least they tend to use the + * same stems to name the structure fields, so by using this macro we + * can share a fair amount of code between different variants. */ +#if defined __FreeBSD__ +#define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem +#elif defined __OpenBSD__ +#define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem +#else +#error unsupported BSD variant +#endif + +#endif /* _X86_BSD_OS_H */