X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fx86-bsd-os.h;h=5f1e242592a582712c608aa00ca1661ac0d01ef6;hb=c3699db2053ff3b5ac6a98d4431c3789496002d8;hp=d1e39f908e4191765c62c3ced649febe23bdebaf;hpb=68fd2d2dd6f265669a8957accd8a33e62786a97e;p=sbcl.git diff --git a/src/runtime/x86-bsd-os.h b/src/runtime/x86-bsd-os.h index d1e39f9..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; + 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 */