Skip to content

Commit b5f13d4

Browse files
committed
ii
1 parent fc6dc65 commit b5f13d4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

libr/arch/p/arm/armass64.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,17 @@ static ut32 tb(ArmOp *op) {
865865
} else {
866866
return UT32_MAX;
867867
}
868+
if (reg64_imm) {
869+
if (op->operands[1].immediate > 0x3f) {
870+
R_LOG_ERROR ("Bit to be tested must be in range 0-63 for %s", op->mnemonic);
871+
return UT32_MAX;
872+
}
873+
} else if (reg32_imm) {
874+
if (op->operands[1].immediate > 0x1f) {
875+
R_LOG_ERROR ("Bit to be tested must be in range 0-31 for %s", op->mnemonic);
876+
return UT32_MAX;
877+
}
878+
}
868879
ut64 dst = op->operands[2].immediate;
869880
st64 delta = dst - op->addr;
870881
ut64 maxis = R_ABS (delta);
@@ -2182,20 +2193,28 @@ bool arm64ass (const char *str, ut64 addr, ut32 *op) {
21822193
} else if (r_str_startswith (str, "ldur")) {
21832194
*op = regsluop (&ops, 0x000040f8);
21842195
} else if (r_str_startswith (str, "str")) {
2196+
#if 0
2197+
// AITODO: maybe
2198+
*op = reglsop (&ops, 0x000000f8);
2199+
#else
21852200
*op = UT32_MAX;
21862201
*op = lsop (&ops, 0x000000f8, -1);
21872202
if (*op == UT32_MAX) {
21882203
*op = reglsop (&ops, 0x000000f8);
21892204
}
2205+
#endif
21902206
} else if (r_str_startswith (str, "stp")) {
21912207
*op = stp (&ops, 0x000000a9);
21922208
} else if (r_str_startswith (str, "ldp")) {
21932209
*op = stp (&ops, 0x000040a9);
21942210
} else if (r_str_startswith (str, "sub") && !r_str_startswith (str, "subg") && !r_str_startswith (str, "subp")) { // w, skip this for mte versions of sub, e.g. subg, subp ins
21952211
*op = arithmetic (&ops, 0xd1);
2212+
#if 0
2213+
// AITODO
21962214
} else if (r_str_startswith (str, "msub x")) {
21972215
/* msub: multiply-subtract (Rd = Rn * Rm - Ra) */
21982216
*op = math (&ops, 0x1b008000, true);
2217+
#endif
21992218
} else if (r_str_startswith (str, "madd x")) {
22002219
*op = math (&ops, 0x9b, true);
22012220
} else if (r_str_startswith (str, "add x")) {

test/db/asm/arm_64

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,5 @@ ad "tbnz x29, 0x30, 0x1fd0" 9DFE80B7
667667
ad "tbnz w25, 0x16, 0x14" B900B037
668668
ad "tbnz w30, 0xf, 4" 3E007837
669669
ad "tbnz w11, 0x1d, 0x18" CB00E837
670+
ad "msub x7, x8, x9, x5" 0795099b
671+
ad "str x2, [x16, 0x2058]" 022e10f9

0 commit comments

Comments
 (0)