Skip to content

Commit

Permalink
x64: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trou committed Mar 26, 2020
1 parent e57fda4 commit 5c0598f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml/src/disassembly/core_x86.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ module Make(Arch: Arch)(Domain: Domain.T)(Stubs: Stubs.T with type domain_t := D
let rm' =
if s.rex.b_used then rm
else
(** rex.b is used to specify the top bit of rm *)
(* rex.b is used to specify the top bit of rm *)
begin
s.rex.b_used <- true;
s.rex.b_ lsl 3 + rm
Expand Down
20 changes: 20 additions & 0 deletions test/test_x64_isn.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ def test_mov_mem(tmpdir, op64, op8):
""".format(**locals())
compare(tmpdir, asm, ["rbx", "rcx", "rdx", "r8"])

def test_mov_mem_bpl(tmpdir, op32 ):
asm = """
mov eax, {op32:#x}
mov [0x100000], rax
push rbp
xor ebp, ebp
mov bpl, [0x100000]
mov rbx, rbp
pop rbp
""".format(**locals())
compare(tmpdir, asm, ["rbx"])

def test_mov_mem_reg64_off(tmpdir, op64, op8, op32):
asm = """
mov rax, {op64}
Expand Down Expand Up @@ -449,6 +461,14 @@ def test_arith_inc_reg64_32(tmpdir, op64):
""".format(**locals())
compare(tmpdir, asm, ["rax", "of", "sf", "zf", "pf", "af"])

def test_arith_xor_reg64_32(tmpdir, op64, op64_):
asm = """
mov rax, {op64:#x}
mov rbx, {op64_:#x}
xor eax, ebx
""".format(**locals())
compare(tmpdir, asm, ["rax", "of", "sf", "zf", "pf"])

## _
## ___ ___ __ _ _ __ ___ ___ _ __ | |_ ___
## / __|/ _ \/ _` | '_ ` _ \ / _ \ '_ \| __/ __|
Expand Down

0 comments on commit 5c0598f

Please sign in to comment.