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