Skip to content

Commit

Permalink
Fix ASR instruction (AArch64)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheitman committed Aug 2, 2023
1 parent 5b59292 commit 87b0830
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libtriton/arch/arm/aarch64/aarch64Semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,10 +1128,14 @@ namespace triton {
auto& dst = inst.operands[0];
auto& src1 = inst.operands[1];
auto& src2 = inst.operands[2];
auto size = src2.getBitSize();

/* Create symbolic operands */
auto op1 = this->symbolicEngine->getOperandAst(inst, src1);
auto op2 = this->symbolicEngine->getOperandAst(inst, src2);
auto op2 = this->astCtxt->bvand(
this->symbolicEngine->getOperandAst(inst, src2),
this->astCtxt->bv(size - 1, size)
);

/* Create the semantics */
auto node = this->astCtxt->bvashr(op1, op2);
Expand Down
4 changes: 4 additions & 0 deletions src/testers/aarch64/unicorn_test_aarch64.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@
(b"\x42\x00\x80\xd2", "movz x2, #0x2"),
(b"\x20\x28\xc2\x9a", "asr x0, x1, x2"),

(b"\x20\x28\x88\xd2", "movz x0, #0x4141"),
(b"\x20\x28\xa8\xf2", "movk x0, #0x4141, lsl #16"),
(b"\x01\x28\xc0\x1a", "asr w1, w0, w0"),

(b"\x82\x46\x82\xd2", "movz x2, #0x1234"),
(b"\x01\xcf\x8a\xd2", "movz x1, #0x5678"),
(b"\x20\x80\x22\xcb", "sub x0, x1, w2, sxtb"),
Expand Down

0 comments on commit 87b0830

Please sign in to comment.