Skip to content

Commit 9047d5a

Browse files
committed
Fix #24640 - arm64 assembler for msub and str ##arch
1 parent 8170efd commit 9047d5a

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

libr/arch/p/arm/armass64.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -865,17 +865,6 @@ 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-
}
879868
ut64 dst = op->operands[2].immediate;
880869
st64 delta = dst - op->addr;
881870
ut64 maxis = R_ABS (delta);
@@ -2193,13 +2182,20 @@ bool arm64ass (const char *str, ut64 addr, ut32 *op) {
21932182
} else if (r_str_startswith (str, "ldur")) {
21942183
*op = regsluop (&ops, 0x000040f8);
21952184
} else if (r_str_startswith (str, "str")) {
2196-
*op = reglsop (&ops, 0x000000f8);
2185+
*op = UT32_MAX;
2186+
*op = lsop (&ops, 0x000000f8, -1);
2187+
if (*op == UT32_MAX) {
2188+
*op = reglsop (&ops, 0x000000f8);
2189+
}
21972190
} else if (r_str_startswith (str, "stp")) {
21982191
*op = stp (&ops, 0x000000a9);
21992192
} else if (r_str_startswith (str, "ldp")) {
22002193
*op = stp (&ops, 0x000040a9);
22012194
} 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
22022195
*op = arithmetic (&ops, 0xd1);
2196+
} else if (r_str_startswith (str, "msub x")) {
2197+
/* msub: multiply-subtract (Rd = Rn * Rm - Ra) */
2198+
*op = math (&ops, 0x1b008000, true);
22032199
} else if (r_str_startswith (str, "madd x")) {
22042200
*op = math (&ops, 0x9b, true);
22052201
} else if (r_str_startswith (str, "add x")) {

0 commit comments

Comments
 (0)