1 | /* |
---|
2 | Copyright (C) 2010 Clozure Associates |
---|
3 | Copyright (C) 1994-2001 Digitool, Inc |
---|
4 | This file is part of Clozure CL. |
---|
5 | |
---|
6 | Clozure CL is licensed under the terms of the Lisp Lesser GNU Public |
---|
7 | License , known as the LLGPL and distributed with Clozure CL as the |
---|
8 | file "LICENSE". The LLGPL consists of a preamble and the LGPL, |
---|
9 | which is distributed with Clozure CL as the file "LGPL". Where these |
---|
10 | conflict, the preamble takes precedence. |
---|
11 | |
---|
12 | Clozure CL is referenced in the preamble as the "LIBRARY." |
---|
13 | |
---|
14 | The LLGPL is also available online at |
---|
15 | http://opensource.franz.com/preamble.html |
---|
16 | */ |
---|
17 | |
---|
18 | #define WORD_SIZE 64 |
---|
19 | #define PLATFORM_OS PLATFORM_OS_FREEBSD |
---|
20 | #define PLATFORM_CPU PLATFORM_CPU_X86 |
---|
21 | #define PLATFORM_WORD_SIZE PLATFORM_WORD_SIZE_64 |
---|
22 | |
---|
23 | typedef struct __ucontext ExceptionInformation; |
---|
24 | |
---|
25 | #include "standard-inttypes.h" |
---|
26 | |
---|
27 | #define MAXIMUM_MAPPABLE_MEMORY (512L<<30L) |
---|
28 | #define IMAGE_BASE_ADDRESS 0x300000000000L |
---|
29 | |
---|
30 | #include "lisptypes.h" |
---|
31 | #include "x86-constants64.h" |
---|
32 | #define REG_RDI 1 |
---|
33 | #define REG_RSI 2 |
---|
34 | #define REG_RDX 3 |
---|
35 | #define REG_RCX 4 |
---|
36 | #define REG_R8 5 |
---|
37 | #define REG_R9 6 |
---|
38 | #define REG_RAX 7 |
---|
39 | #define REG_RBX 8 |
---|
40 | #define REG_RBP 9 |
---|
41 | #define REG_R10 10 |
---|
42 | #define REG_R11 11 |
---|
43 | #define REG_R12 12 |
---|
44 | #define REG_R13 13 |
---|
45 | #define REG_R14 14 |
---|
46 | #define REG_R15 15 |
---|
47 | #define REG_RIP 20 |
---|
48 | #define REG_RFL 22 |
---|
49 | #define REG_RSP 23 |
---|
50 | |
---|
51 | #include <machine/fpu.h> |
---|
52 | #define xpGPRvector(x) ((natural *)(&((x)->uc_mcontext))) |
---|
53 | #define xpGPR(x,gprno) (xpGPRvector(x)[gprno]) |
---|
54 | #define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new) |
---|
55 | #define eflags_register(xp) xpGPR(xp,Iflags) |
---|
56 | #define xpPC(x) xpGPR(x,Iip) |
---|
57 | #define xpMMXreg(x,n) *((natural *)(&(((struct savefpu *)(&(x)->uc_mcontext.mc_fpstate))->sv_fp[n]))) |
---|
58 | #define xpXMMregs(x)(&(((struct savefpu *)(&(x)->uc_mcontext.mc_fpstate))->sv_xmm[0])) |
---|
59 | #define xpMXCSR(x) (((struct savefpu *)(&(x)->uc_mcontext.mc_fpstate))->sv_env.en_mxcsr) |
---|
60 | extern void freebsd_sigreturn(ExceptionInformation *); |
---|
61 | #define SIGNUM_FOR_INTN_TRAP SIGBUS |
---|
62 | #define IS_MAYBE_INT_TRAP(info,xp) ((xp->uc_mcontext.mc_trapno == T_PROTFLT) && ((xp->uc_mcontext.mc_err & 7) == 2)) |
---|
63 | #define IS_PAGE_FAULT(info,xp) (xp->uc_mcontext.mc_trapno == T_PAGEFLT) |
---|
64 | #define SIGRETURN(context) do {freebsd_sigreturn(context); \ |
---|
65 | Bug(context,"sigreturn returned"); \ |
---|
66 | } while (0) |
---|
67 | |
---|
68 | /* AVX stuff. Funky, because some of this isn't defined until |
---|
69 | fbsd 9.1 headers; if we built on an older OS version, we still need |
---|
70 | to know about this if we run on 9.1+ */ |
---|
71 | |
---|
72 | #define AVX_CONTEXT_PRESENT(xp) ((xp)->uc_mcontext.mc_trapno & 4) |
---|
73 | #define AVX_CONTEXT_PTR(xp) (((xp)->uc_mcontext.mc_fpstate[66])) |
---|
74 | #define AVX_CONTEXT_SIZE(xp) ((natural)((xp)->uc_mcontext.mc_fpstate[67])) |
---|
75 | |
---|
76 | #include "os-freebsd.h" |
---|
77 | |
---|