0.8.5.49:
[sbcl/simd.git] / src / runtime / bsd-os.h
blobd95431df0fbc5c59c6e1fe57362369160bd8aa02
1 /*
2 * This software is part of the SBCL system. See the README file for
3 * more information.
5 * This software is derived from the CMU CL system, which was
6 * written at Carnegie Mellon University and released into the
7 * public domain. The software is in the public domain and is
8 * provided with absolutely no warranty. See the COPYING and CREDITS
9 * files for more information.
12 #ifdef __FreeBSD__
13 #include <osreldate.h>
14 #endif
16 #include <sys/types.h>
17 #include <sys/mman.h>
18 #include <sys/signal.h>
20 typedef caddr_t os_vm_address_t;
21 typedef vm_size_t os_vm_size_t;
22 typedef off_t os_vm_offset_t;
23 typedef int os_vm_prot_t;
24 typedef int os_context_register_t;
26 #if defined __OpenBSD__
27 /* name defined for compatibility between OpenBSD 3.1 sigaltstack(2) and
28 * Linux sigaltstack(2) */
29 typedef struct sigaltstack stack_t;
30 #elif defined __FreeBSD__
31 /* FreeBSD 4.6 already has stack_t defined. */
32 #endif
34 #if defined __FreeBSD__
35 /* Note: The man page for sigaction(2) in FreeBSD 4.0 says that this
36 * is an mcontext_t, but according to comments by Raymond Wiker in the
37 * original FreeBSD port of SBCL, that's wrong, it's actually a
38 * ucontext_t. */
40 #include <sys/ucontext.h>
41 typedef ucontext_t os_context_t;
42 /* As the sbcl-devel message from Raymond Wiker 2000-12-01, FreeBSD
43 * (unlike Linux and OpenBSD) doesn't let us tweak the CPU's single
44 * step flag bit by messing with the flags stored in a signal context,
45 * so we need to implement single stepping in a more roundabout way. */
46 #define CANNOT_GET_TO_SINGLE_STEP_FLAG
47 #define SIG_MEMORY_FAULT SIGBUS
48 #elif defined __OpenBSD__
49 typedef struct sigcontext os_context_t;
50 #define SIG_MEMORY_FAULT SIGSEGV
51 #elif defined DARWIN
52 /* man pages claim that the third argument is a sigcontext struct,
53 but ucontext_t is defined, matches sigcontext where sensible,
54 offers better access to mcontext, and is of course the SUSv2-
55 mandated type of the third argument, so we use that instead.
56 If Apple is going to break ucontext_t out of spite, I'm going
57 to be cross with them ;) -- PRM */
59 #include <ucontext.h>
60 typedef ucontext_t os_context_t;
61 #define SIG_MEMORY_FAULT SIGBUS
62 #else
63 #error unsupported BSD variant
64 #endif
66 #include "target-arch-os.h"
67 #include "target-arch.h"
69 #define OS_VM_PROT_READ PROT_READ
70 #define OS_VM_PROT_WRITE PROT_WRITE
71 #define OS_VM_PROT_EXECUTE PROT_EXEC