AMD64 fixes

release
Slava Pestov 2007-09-22 03:09:18 -04:00
parent 136e249f6d
commit dacab19574
6 changed files with 12 additions and 9 deletions

View File

@ -206,10 +206,10 @@ M: x86-backend %box-small-struct ( size -- )
M: x86-backend %prepare-alien-indirect ( -- )
"unbox_alien" f %alien-invoke
ESP cell temp@ [+] EAX MOV ;
cell temp@ EAX MOV ;
M: x86-backend %alien-indirect ( -- )
ESP cell temp@ [+] CALL ;
cell temp@ CALL ;
M: x86-backend %alien-callback ( quot -- )
4 [

View File

@ -16,10 +16,10 @@ M: amd64-backend stack-reg RSP ;
M: x86-backend xt-reg RCX ;
M: x86-backend stack-save-reg RSI ;
M: temp-reg v>operand drop R13 ;
M: temp-reg v>operand drop RBX ;
M: int-regs return-reg drop RAX ;
M: int-regs vregs drop { RAX RBX RCX RDX RBP RSI RDI R8 R9 R10 R11 R12 } ;
M: int-regs vregs drop { RAX RCX RDX RBP RSI RDI R8 R9 R10 R11 R12 R13 } ;
M: int-regs param-regs drop { RDI RSI RDX RCX R8 R9 } ;
M: float-regs return-reg drop XMM0 ;
@ -146,17 +146,17 @@ M: amd64-backend %alien-indirect ( -- )
cell temp@ CALL ;
M: amd64-backend %alien-callback ( quot -- )
RDI load-indirect "run_callback" f compile-c-call ;
RDI load-indirect "c_to_factor" f compile-c-call ;
M: amd64-backend %callback-value ( ctype -- )
! Save top of data stack
%prepare-unbox
! Put former top of data stack in RDI
temp@ RDI MOV
cell temp@ RDI MOV
! Restore data/call/retain stacks
"unnest_stacks" f %alien-invoke
! Put former top of data stack in RDI
RDI temp@ MOV
RDI cell temp@ MOV
! Unbox former top of data stack to return registers
unbox-return ;

View File

@ -150,7 +150,7 @@ M: x86-backend small-enough? ( n -- ? )
: %tag-fixnum ( reg -- ) tag-bits get SHL ;
: temp@ \ stack-frame get swap - ;
: temp@ stack-reg \ stack-frame get rot - [+] ;
: struct-return@ ( size n -- n )
[

View File

@ -29,7 +29,7 @@ DEF(FASTCALL void,dosym,(CELL word)):
/* Here we have two entry points. The first one is taken when profiling is
enabled */
DEF(FASTCALL void,docol_profiling,(CELL word)):
add $CELL_SIZE,PROFILING_OFFSET(%eax) /* Increment profile-count slot */
add $CELL_SIZE,PROFILING_OFFSET(ARG0) /* Increment profile-count slot */
DEF(FASTCALL void,docol,(CELL word)):
mov WORD_DEF_OFFSET(ARG0),ARG0 /* Load word-def slot */
JUMP_QUOT

View File

@ -135,6 +135,7 @@ void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded
}
nest_stacks();
printf("%lx\n",untag_quotation(userenv[BOOT_ENV])->xt);
c_to_factor_toplevel(userenv[BOOT_ENV]);
unnest_stacks();

2
vm/os-linux-x86-64.h Normal file
View File

@ -0,0 +1,2 @@
#define UAP_PROGRAM_COUNTER(ucontext) \
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[16])