From 3aacc18c772a20c38c82eafeeb0e42ca05844382 Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Sun, 23 Oct 2022 22:11:08 -0700 Subject: [PATCH] Port emulator poke to arm --- jit/gadgets-aarch64/entry.S | 8 ++++++++ jit/gadgets-x86_64/entry.S | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/jit/gadgets-aarch64/entry.S b/jit/gadgets-aarch64/entry.S index 456703bc2a..2170f1f026 100644 --- a/jit/gadgets-aarch64/entry.S +++ b/jit/gadgets-aarch64/entry.S @@ -21,10 +21,18 @@ NAME(jit_enter): jit_ret_chain: cmp _ip, 0 b.lt jit_ret + ldr x8, [_cpu, CPU_poked_ptr] + ldrb w8, [x8] + cmp w8, 0 + b.ne poke sub x8, _ip, JIT_BLOCK_code str x8, [_cpu, LOCAL_last_block] gret +poke: + ldr eip, [_ip, -JIT_BLOCK_code+JIT_BLOCK_addr] + # fallthrough + .global jit_ret jit_ret: # load -1 diff --git a/jit/gadgets-x86_64/entry.S b/jit/gadgets-x86_64/entry.S index 1b14172399..c1397507ce 100644 --- a/jit/gadgets-x86_64/entry.S +++ b/jit/gadgets-x86_64/entry.S @@ -23,22 +23,22 @@ NAME(jit_enter): .global jit_ret_chain jit_ret_chain: btq $63, %_ip - jc 1f + jc jit_ret mov CPU_poked_ptr(%_cpu), %r10 - testb $1, (%r10) + cmpb $0, (%r10) jnz poke leaq -JIT_BLOCK_code(%_ip), %r10 mov %r10, LOCAL_last_block(%_cpu) gret -1: -.global jit_ret -jit_ret: - movl $-1, %_tmp - jmp jit_exit poke: mov -JIT_BLOCK_code+JIT_BLOCK_addr(%_ip), %_eip - jmp jit_ret + # fallthrough + +.global jit_ret +jit_ret: + movl $-1, %_tmp + # fallthrough .global jit_exit jit_exit: