d03b8aa8accc84fa54ecdc48495b692a3bc59291
[sbcl.git] / src / runtime / x86-bsd-os.h
1 #ifndef _X86_BSD_OS_H
2 #define _X86_BSD_OS_H
3
4 static inline os_context_t *arch_os_get_context(void **void_context) {
5     return (os_context_t *) *void_context;
6 }
7
8 /* The different BSD variants have diverged in exactly where they
9  * store signal context information, but at least they tend to use the
10  * same stems to name the structure fields, so by using this macro we
11  * can share a fair amount of code between different variants. */
12 #if defined __FreeBSD__
13 #define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem
14 #elif defined(__OpenBSD__)
15 #define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem
16 #elif defined __NetBSD__
17 #define CONTEXT_ADDR_FROM_STEM(stem) &((context)->uc_mcontext.__gregs[_REG_ ## stem])
18 #else
19 #error unsupported BSD variant
20 #endif
21
22 #if defined LISP_FEATURE_FREEBSD
23 #define RESTORE_FP_CONTROL_FROM_CONTEXT
24 void os_restore_fp_control(os_context_t *context);
25 #endif
26
27 #endif /* _X86_BSD_OS_H */