8 #define RETURN_REG %eax
10 #define NV_TEMP_REG %ebx
12 #define ARITH_TEMP_1 %ebp
13 #define ARITH_TEMP_2 %ebx
14 #define DIV_RESULT %eax
17 #define STACK_PADDING 12
19 #define PUSH_NONVOLATILE \
24 #define POP_NONVOLATILE \
29 #define QUOT_XT_OFFSET 12
31 /* We pass a function pointer to memcpy to work around a Mac OS X
32 ABI limitation which would otherwise require us to do a bizzaro PC-relative
33 trampoline to retrieve the function address */
34 DEF(void,set_callstack,(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy)):
35 mov 4(%esp),%ebp /* to */
36 mov 8(%esp),%edx /* from */
37 mov 12(%esp),%ecx /* length */
38 mov 16(%esp),%eax /* memcpy */
39 sub %ecx,%ebp /* compute new stack pointer */
41 push %ecx /* pass length */
42 push %edx /* pass src */
43 push %ebp /* pass dst */
44 call *%eax /* call memcpy */
45 add $12,%esp /* pop args from the stack */
46 ret /* return _with new stack_ */
48 DEF(long long,read_timestamp_counter,(void)):
52 DEF(void,primitive_inline_cache_miss,(void *vm)):
54 DEF(void,primitive_inline_cache_miss_tail,(void *vm)):
56 push ARG0 /* push vm ptr */
58 call MANGLE(inline_cache_miss)
62 DEF(void,get_sse_env,(void*)):
67 DEF(void,set_sse_env,(const void*)):
72 DEF(void,get_x87_env,(void*)):
78 DEF(void,set_x87_env,(const void*)):
84 DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to, void *vm)):
85 mov CELL_SIZE(STACK_REG),NV_TEMP_REG /* get vm ptr in case quot_xt = lazy_jit_compile */
86 /* clear x87 stack, but preserve rounding mode and exception flags */
94 jmp *QUOT_XT_OFFSET(ARG0)
97 DEF(F_FASTCALL void,lazy_jit_compile,(CELL quot, void *vm)):
98 mov ARG1,NV_TEMP_REG /* stash vm ptr */
99 mov STACK_REG,ARG1 /* Save stack pointer */
100 sub $STACK_PADDING,STACK_REG
101 push NV_TEMP_REG /* push vm ptr as arg3 */
102 call MANGLE(lazy_jit_compile_impl)
104 mov RETURN_REG,ARG0 /* No-op on 32-bit */
105 add $STACK_PADDING,STACK_REG
106 jmp *QUOT_XT_OFFSET(ARG0) /* Call the quotation */
113 .ascii " -export:read_timestamp_counter"
114 .ascii " -export:get_sse_env"
115 .ascii " -export:set_sse_env"
116 .ascii " -export:get_x87_env"
117 .ascii " -export:set_x87_env"