Fixes a crash when compiling the project on windows in 64 bit mode.
Not all non-volatile registers were actually saved and restored, leading to a few registers being trashed after calling the vm instructions. All non-volatile registers have been added.
This commit is contained in:
parent
4003a5b78c
commit
60a2000419
1 changed files with 13 additions and 2 deletions
|
@ -30,9 +30,15 @@
|
||||||
; uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase);
|
; uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase);
|
||||||
|
|
||||||
qvmcall64 PROC
|
qvmcall64 PROC
|
||||||
push rsi ; push non-volatile registers to stack
|
push r12 ; push all non-volatile registers to stack
|
||||||
|
push r13
|
||||||
|
push r14
|
||||||
|
push r15
|
||||||
push rdi
|
push rdi
|
||||||
|
push rsi
|
||||||
push rbx
|
push rbx
|
||||||
|
push rbp
|
||||||
|
|
||||||
; need to save pointer in rcx so we can write back the programData value to caller
|
; need to save pointer in rcx so we can write back the programData value to caller
|
||||||
push rcx
|
push rcx
|
||||||
|
|
||||||
|
@ -48,9 +54,14 @@ qvmcall64 PROC
|
||||||
mov dword ptr [rcx], esi ; write back the programStack value
|
mov dword ptr [rcx], esi ; write back the programStack value
|
||||||
mov al, bl ; return opStack offset
|
mov al, bl ; return opStack offset
|
||||||
|
|
||||||
|
pop rbp ; restore all non-volatile registers after the call
|
||||||
pop rbx
|
pop rbx
|
||||||
pop rdi
|
|
||||||
pop rsi
|
pop rsi
|
||||||
|
pop rdi
|
||||||
|
pop r15
|
||||||
|
pop r14
|
||||||
|
pop r13
|
||||||
|
pop r12
|
||||||
|
|
||||||
ret
|
ret
|
||||||
qvmcall64 ENDP
|
qvmcall64 ENDP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue