715031647d018b496f42e4e4d955a711746b8d4b
[projects/cmucl/cmucl.git] / src / lisp / FreeBSD-os.h
1 /*
2
3  $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.h,v 1.23 2009/01/20 04:45:18 agoncharov Rel $
4
5  This code was written as part of the CMU Common Lisp project at
6  Carnegie Mellon University, and has been placed in the public domain.
7
8 */
9
10 #ifndef _FREEBSD_OS_H_
11 #define _FREEBSD_OS_H_
12
13 #include <sys/mman.h>
14
15 #include <osreldate.h>
16 #include <signal.h>
17 #include <ucontext.h>
18
19 typedef void *os_vm_address_t;
20 typedef size_t os_vm_size_t;
21 typedef off_t os_vm_offset_t;
22 typedef int os_vm_prot_t;
23 #define os_context_t ucontext_t
24
25 #define OS_VM_PROT_READ    PROT_READ
26 #define OS_VM_PROT_WRITE   PROT_WRITE
27 #define OS_VM_PROT_EXECUTE PROT_EXEC
28
29 #define OS_VM_DEFAULT_PAGESIZE  4096
30
31 /* ucontext_t *context; using `void *' to compile without warning */
32 #define HANDLER_ARGS int signal, siginfo_t *code, void *context
33
34 #define CODE(code)  ((code) ? code->si_code : 0)
35 #define RESTORE_FPU(context) restore_fpu(context)
36
37 void restore_fpu(ucontext_t *);
38
39 #if __FreeBSD_version < 700004
40 #define PROTECTION_VIOLATION_SIGNAL SIGBUS
41 #define PROTECTION_VIOLATION_CODE BUS_PAGE_FAULT
42 #else
43 #define PROTECTION_VIOLATION_SIGNAL SIGSEGV
44 #define PROTECTION_VIOLATION_CODE SEGV_ACCERR
45 #endif
46
47 #endif /* _FREEBSD_OS_H_ */