]> gitweb.factorcode.org Git - factor.git/commitdiff
VM fixes for Win64 calling convention
authorunknown <Administrator@.(none)>
Sun, 9 Nov 2008 02:32:23 +0000 (20:32 -0600)
committerunknown <Administrator@.(none)>
Sun, 9 Nov 2008 02:32:23 +0000 (20:32 -0600)
vm/cpu-x86.32.S
vm/cpu-x86.64.S
vm/cpu-x86.S

index e0e674a7e2b7b68d6fdbf70a9e752f61e8e4b61e..eec850dc9e3735aa05a60fb53e652e6d77b1c5dc 100755 (executable)
@@ -10,14 +10,18 @@ and the callstack top is passed in EDX */
 #define DS_REG %esi
 #define RETURN_REG %eax
 
+#define NV_TEMP_REG %rbx
+
 #define CELL_SIZE 4
 #define STACK_PADDING 12
 
 #define PUSH_NONVOLATILE \
        push %ebx ; \
+       push %ebp ; \
        push %ebp
 
 #define POP_NONVOLATILE \
+       pop %ebp ; \
        pop %ebp ; \
        pop %ebx
 
index 15a4eb8da32f56c5c823a724b7559bb36e796d7a..c981095d62ac85104ba3667919b1617a2454282e 100644 (file)
@@ -7,6 +7,8 @@
 #define CELL_SIZE 8
 #define STACK_PADDING 56
 
+#define NV_TEMP_REG %rbp
+
 #ifdef WINDOWS
 
        #define ARG0 %rcx
                push %rdi ; \
                push %rsi ; \
                push %rbx ; \
+               push %rbp ; \
                push %rbp
 
        #define POP_NONVOLATILE \
+               pop %rbp ; \
                pop %rbp ; \
                pop %rbx ; \
                pop %rsi ; \
                push %rbx ; \
                push %rbp ; \
                push %r12 ; \
+               push %r13 ; \
                push %r13
 
        #define POP_NONVOLATILE \
+               pop %r13 ; \
                pop %r13 ; \
                pop %r12 ; \
                pop %rbp ; \
index 3d6cacdebd177182d69e9e16a0a4317373e272a6..1857fb0ed806de7728148f01ee12da53c800768d 100755 (executable)
@@ -1,20 +1,21 @@
 DEF(F_FASTCALL void,c_to_factor,(CELL quot)):
        PUSH_NONVOLATILE
-       push ARG0
-
-       /* Save stack pointer */
-       lea -CELL_SIZE(STACK_REG),ARG0      
+       mov ARG0,NV_TEMP_REG
 
        /* Create register shadow area for Win64 */
-       sub $32,STACK_REG                    
+       sub $32,STACK_REG
+
+       /* Save stack pointer */
+       lea -CELL_SIZE(STACK_REG),ARG0
        call MANGLE(save_callstack_bottom)
-       add $32,STACK_REG
 
        /* Call quot-xt */
-       mov (STACK_REG),ARG0
+       mov NV_TEMP_REG,ARG0
        call *QUOT_XT_OFFSET(ARG0)
 
-       pop ARG0
+       /* Tear down register shadow area */
+       add $32,STACK_REG
+
        POP_NONVOLATILE
        ret