Skip to content

Commit

Permalink
Port emulator poke to arm
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Oct 24, 2022
1 parent 0511e42 commit 3aacc18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions jit/gadgets-aarch64/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions jit/gadgets-x86_64/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3aacc18

Please sign in to comment.