Fix make-array transforms.
[sbcl.git] / src / runtime / x86-64-bsd-os.h
1 #ifndef _X86_64_BSD_OS_H
2 #define _X86_64_BSD_OS_H
3
4 #ifdef LISP_FEATURE_FREEBSD
5 #include <machine/fpu.h>
6 #endif
7
8 typedef register_t os_context_register_t;
9
10 static inline os_context_t *arch_os_get_context(void **void_context)
11 {
12     return (os_context_t *) *void_context;
13 }
14
15 /* The different BSD variants have diverged in exactly where they
16  * store signal context information, but at least they tend to use the
17  * same stems to name the structure fields, so by using this macro we
18  * can share a fair amount of code between different variants. */
19 #if defined __FreeBSD__
20 #define CONTEXT_ADDR_FROM_STEM(stem) &context->uc_mcontext.mc_ ## stem
21 #elif defined(__OpenBSD__)
22 #define CONTEXT_ADDR_FROM_STEM(stem) &context->sc_ ## stem
23 #elif defined __NetBSD__
24 #define CONTEXT_ADDR_FROM_STEM(stem) &((context)->uc_mcontext.__gregs[_REG_ ## stem])
25 #else
26 #error unsupported BSD variant
27 #endif
28
29 #if defined LISP_FEATURE_FREEBSD
30 #define RESTORE_FP_CONTROL_FROM_CONTEXT
31 void os_restore_fp_control(os_context_t *context);
32
33 /* FreeBSD does not setup si_code on XMM exception. */
34 #define X86_64_SIGFPE_FIXUP
35
36 static inline unsigned int *
37 arch_os_context_mxcsr_addr(os_context_t *context)
38 {
39     struct envxmm *ex = (struct envxmm *)(&context->uc_mcontext.mc_fpstate);
40     return &ex->en_mxcsr;
41 }
42 #endif
43
44 #if defined LISP_FEATURE_OPENBSD
45 #define RESTORE_FP_CONTROL_FROM_CONTEXT
46 void os_restore_fp_control(os_context_t *context);
47 #endif
48
49 #endif /* _X86_64_BSD_OS_H */