From 4a6b6d85b53949f597768c435be36afafa2e1cb2 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Sat, 22 Jul 2023 06:46:02 -0500 Subject: [PATCH] Add pop alias instruction for t2LDR_POST --- arch/ARM/ARMInstPrinter.c | 18 +++++++++++++++--- arch/ARM/ARMMapping.c | 6 ++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/arch/ARM/ARMInstPrinter.c b/arch/ARM/ARMInstPrinter.c index ef08a3345..e486a9d1b 100644 --- a/arch/ARM/ARMInstPrinter.c +++ b/arch/ARM/ARMInstPrinter.c @@ -212,9 +212,9 @@ static void printInst(MCInst *MI, SStream *O, void *info) break; case ARM_LDR_POST_IMM: - if (MCOperand_getReg(MCInst_getOperand(MI, (2))) == ARM_SP && - ARM_AM_getAM2Offset(MCOperand_getImm( - MCInst_getOperand(MI, (4)))) == 4) { + if ((MCOperand_getReg(MCInst_getOperand(MI, (2))) == ARM_SP) && + ((ARM_AM_getAM2Offset(MCOperand_getImm( + MCInst_getOperand(MI, (4)))) == 4))) { SStream_concat0(O, "pop"); printPredicateOperand(MI, 5, O); SStream_concat0(O, " {"); @@ -223,6 +223,18 @@ static void printInst(MCInst *MI, SStream *O, void *info) return; } else break; + case ARM_t2LDR_POST: + if ((MCOperand_getReg(MCInst_getOperand(MI, (2))) == ARM_SP) && + (Opcode == ARM_t2LDR_POST && + (MCOperand_getImm(MCInst_getOperand(MI, (3))) == 4))) { + SStream_concat0(O, "pop"); + printPredicateOperand(MI, 4, O); + SStream_concat0(O, " {"); + printOperand(MI, 0, O); + SStream_concat0(O, "}"); + return; + } else + break; // A8.6.355 VPUSH case ARM_VSTMSDB_UPD: diff --git a/arch/ARM/ARMMapping.c b/arch/ARM/ARMMapping.c index 7dc546c8a..f4e2b89d1 100644 --- a/arch/ARM/ARMMapping.c +++ b/arch/ARM/ARMMapping.c @@ -365,6 +365,12 @@ static void ARM_add_not_defined_ops(MCInst *MI) MCOperand_getImm(MCInst_getOperand(MI, (4)))) == 4) MI->flat_insn->id = ARM_INS_POP; break; + case ARM_t2LDR_POST: + if ((MCOperand_getReg(MCInst_getOperand(MI, (2))) == ARM_SP) && + (Opcode == ARM_t2LDR_POST && + (MCOperand_getImm(MCInst_getOperand(MI, (3))) == 4))) + MI->flat_insn->id = ARM_INS_POP; + break; case ARM_VSTMSDB_UPD: case ARM_VSTMDDB_UPD: if (MCOperand_getReg(MCInst_getOperand(MI, (0))) == ARM_SP)