4 #ifdef LISP_FEATURE_FREEBSD
5 #include <machine/segments.h>
6 #include <machine/cpufunc.h>
9 typedef int os_context_register_t
;
11 static inline os_context_t
*arch_os_get_context(void **void_context
)
13 return (os_context_t
*) *void_context
;
16 /* The different BSD variants have diverged in exactly where they
17 * store signal context information, but at least they tend to use the
18 * same stems to name the structure fields, so by using this macro we
19 * can share a fair amount of code between different variants. */
20 #if defined(LISP_FEATURE_FREEBSD) || defined(__DragonFly__)
21 #define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem
22 #elif defined(__OpenBSD__)
23 #define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem
24 #elif defined __NetBSD__
25 #define CONTEXT_ADDR_FROM_STEM(stem) &((context)->uc_mcontext.__gregs[_REG_ ## stem])
27 #error unsupported BSD variant
30 #if defined LISP_FEATURE_FREEBSD
31 #if defined(LISP_FEATURE_RESTORE_TLS_SEGMENT_REGISTER_FROM_CONTEXT)
32 void os_restore_tls_segment_register(os_context_t
*context
);
34 #define RESTORE_FP_CONTROL_FROM_CONTEXT
35 void os_restore_fp_control(os_context_t
*context
);
38 #if defined(LISP_FEATURE_OPENBSD) || defined(LISP_FEATURE_DRAGONFLY)
39 #define RESTORE_FP_CONTROL_FROM_CONTEXT
40 void os_restore_fp_control(os_context_t
*context
);
43 #endif /* _X86_BSD_OS_H */