diff --git a/vm/Config.amd64 b/vm/Config.amd64 new file mode 100644 index 0000000000..52c570a404 --- /dev/null +++ b/vm/Config.amd64 @@ -0,0 +1 @@ +PLAF_OBJS += vm/cpu-amd64.o diff --git a/vm/Config.linux.amd64 b/vm/Config.linux.amd64 index ab3fcda6db..d7ae032e6a 100644 --- a/vm/Config.linux.amd64 +++ b/vm/Config.linux.amd64 @@ -1,2 +1,3 @@ include vm/Config.linux +include vm/Config.amd64 LIBPATH = -L/usr/X11R6/lib64 -L/usr/X11R6/lib diff --git a/vm/cpu-amd64.S b/vm/cpu-amd64.S new file mode 100644 index 0000000000..eb3c1009ac --- /dev/null +++ b/vm/cpu-amd64.S @@ -0,0 +1,13 @@ +#ifdef __APPLE__ + #define MANGLE(sym) _##sym +#else + #define MANGLE(sym) sym +#endif + +/* Callable from C as +void *native_stack_pointer(void) */ + .globl MANGLE(native_stack_pointer) +MANGLE(native_stack_pointer): + mov %rsp,%rax + add $8,%rax + ret diff --git a/vm/cpu-amd64.h b/vm/cpu-amd64.h index 381aabd7ae..7e75bdc0e0 100644 --- a/vm/cpu-amd64.h +++ b/vm/cpu-amd64.h @@ -5,3 +5,10 @@ register CELL rs asm("r15"); register CELL cards_offset asm("r13"); INLINE void flush_icache(CELL start, CELL len) {} + +void *native_stack_pointer(void); + +typedef struct _F_STACK_FRAME { + struct _F_STACK_FRAME *previous; + CELL *return_address; +} F_STACK_FRAME;