mirror of
https://github.com/ish-app/ish.git
synced 2026-02-01 14:32:26 +00:00
Make jit_exit work no matter where the stack pointer is
This commit is contained in:
parent
706661fe8f
commit
fc54f7bcfb
@ -2,4 +2,5 @@
|
||||
|
||||
struct jit_frame {
|
||||
struct cpu_state cpu;
|
||||
void *bp;
|
||||
};
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#include "emu/interrupt.h"
|
||||
#include "gadgets.h"
|
||||
|
||||
.extern tlb_handle_miss
|
||||
|
||||
.text
|
||||
.global jit_enter
|
||||
.type jit_enter,function
|
||||
jit_enter:
|
||||
@ -15,6 +12,7 @@ jit_enter:
|
||||
push %r15
|
||||
leaq JIT_BLOCK_code(%rdi), %_ip
|
||||
movq %rsi, %_cpu
|
||||
movq %rsp, LOCAL_bp(%_cpu)
|
||||
leaq TLB_entries(%rdx), %_tlb
|
||||
movl CPU_eax(%_cpu), %eax
|
||||
movl CPU_ebx(%_cpu), %ebx
|
||||
@ -24,7 +22,6 @@ jit_enter:
|
||||
movl CPU_edi(%_cpu), %edi
|
||||
movl CPU_ebp(%_cpu), %ebp
|
||||
movl CPU_esp(%_cpu), %_esp
|
||||
# TODO more of those
|
||||
gret
|
||||
|
||||
.global jit_ret_chain
|
||||
@ -48,8 +45,8 @@ jit_exit:
|
||||
movl %edi, CPU_edi(%_cpu)
|
||||
movl %ebp, CPU_ebp(%_cpu)
|
||||
movl %_esp, CPU_esp(%_cpu)
|
||||
# TODO more of those
|
||||
movl %_eip, CPU_eip(%_cpu)
|
||||
movq LOCAL_bp(%_cpu), %rsp
|
||||
pop %r15
|
||||
pop %r14
|
||||
pop %r13
|
||||
|
||||
@ -76,7 +76,6 @@ si_gadgets:
|
||||
.endr
|
||||
|
||||
segfault:
|
||||
addq $8, %rsp # pop return address
|
||||
movl (%_ip), %_eip
|
||||
movl $INT_GPF, %_tmp
|
||||
jmp jit_exit
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "emu/cpu.h"
|
||||
#include "jit/jit.h"
|
||||
#include "jit/frame.h"
|
||||
#include "emu/cpu.h"
|
||||
|
||||
void cpu() {
|
||||
OFFSET(CPU, cpu_state, eax);
|
||||
@ -40,6 +41,8 @@ void cpu() {
|
||||
MACRO(SF_FLAG);
|
||||
MACRO(DF_FLAG);
|
||||
|
||||
OFFSET(LOCAL, jit_frame, bp);
|
||||
|
||||
OFFSET(JIT_BLOCK, jit_block, code);
|
||||
|
||||
OFFSET(TLB, tlb, entries);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user