2 #include <asm/unistd.h>
3 #include <sys/syscall.h>
7 #define CALLSTACK_BOTTOM(ctx) \
8 (ctx->callstack_seg->end - sizeof(cell) * 5)
10 static const fixnum xt_tail_pic_offset = 4 + 1;
12 #define UAP_STACK_POINTER(ucontext) \
13 (((ucontext_t*)ucontext)->uc_mcontext.sp)
14 #define UAP_PROGRAM_COUNTER(ucontext) \
15 (((ucontext_t*)ucontext)->uc_mcontext.pc)
17 // #define CODE_TO_FUNCTION_POINTER(code) (void)0
18 // #define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
19 // #define FUNCTION_CODE_POINTER(ptr) ptr
20 // #define FUNCTION_TOC_POINTER(ptr) ptr
22 inline static unsigned int uap_fpu_status(void* uap) {
23 // ucontext_t* ucontext = (ucontext_t*)uap;
24 // return ucontext->uc_mcontext.fpregs->swd |
25 // ucontext->uc_mcontext.fpregs->mxcsr;
29 inline static void uap_clear_fpu_status(void* uap) {
30 // ucontext_t* ucontext = (ucontext_t*)uap;
31 // ucontext->uc_mcontext.fpregs->swd = 0;
32 // ucontext->uc_mcontext.fpregs->mxcsr &= 0xffffffc0;
35 inline static unsigned int fpu_status(unsigned int status) {
39 r |= FP_TRAP_INVALID_OPERATION;
41 r |= FP_TRAP_ZERO_DIVIDE;
43 r |= FP_TRAP_OVERFLOW;
45 r |= FP_TRAP_UNDERFLOW;
51 // FP_TRAP_INVALID_OPERATION = 1 << 0,
52 // FP_TRAP_OVERFLOW = 1 << 1,
53 // FP_TRAP_UNDERFLOW = 1 << 2,
54 // FP_TRAP_ZERO_DIVIDE = 1 << 3,
55 // FP_TRAP_INEXACT = 1 << 4,
58 // #define UAP_STACK_POINTER(ucontext) \
59 // (((ucontext_t*)ucontext)->uc_mcontext.regs[15])
60 // #define UAP_PROGRAM_COUNTER(ucontext) \
61 // (((ucontext_t*)ucontext)->uc_mcontext.regs[16])
63 #define CODE_TO_FUNCTION_POINTER(code) (void)0
64 #define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
65 #define FUNCTION_CODE_POINTER(ptr) ptr
66 #define FUNCTION_TOC_POINTER(ptr) ptr
68 // Must match the stack-frame-size constant in
69 // bootstrap/assembler/x86.64.unix.factor
70 static const unsigned JIT_FRAME_SIZE = 32;
73 static const unsigned char call_opcode = 0xe8;
74 static const unsigned char jmp_opcode = 0xe9;
77 static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 192;