Don't re-resolve register value - riscv5 (#2177)

pull/2172/head
OBarronCS 2 years ago committed by GitHub
parent 68c648bee0
commit 6b3f8155ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -20,10 +20,10 @@ class DisassemblyAssistant(pwndbg.disasm.arch.DisassemblyAssistant):
self, instruction: PwndbgInstruction, emu: Emulator | None self, instruction: PwndbgInstruction, emu: Emulator | None
) -> InstructionCondition: ) -> InstructionCondition:
# B-type instructions have two source registers that are compared # B-type instructions have two source registers that are compared
src1_unsigned = self.parse_register(instruction, instruction.op_find(CS_OP_REG, 1), emu) src1_unsigned = instruction.op_find(CS_OP_REG, 1).before_value
# compressed instructions c.beqz and c.bnez only use one register operand. # compressed instructions c.beqz and c.bnez only use one register operand.
if instruction.op_count(CS_OP_REG) > 1: if instruction.op_count(CS_OP_REG) > 1:
src2_unsigned = self.parse_register(instruction, instruction.op_find(CS_OP_REG, 2), emu) src2_unsigned = instruction.op_find(CS_OP_REG, 2).before_value
else: else:
src2_unsigned = 0 src2_unsigned = 0
@ -96,7 +96,7 @@ class DisassemblyAssistant(pwndbg.disasm.arch.DisassemblyAssistant):
# Determine the target address of the indirect jump # Determine the target address of the indirect jump
if instruction.id in [RISCV_INS_JALR, RISCV_INS_C_JALR]: if instruction.id in [RISCV_INS_JALR, RISCV_INS_C_JALR]:
target = ( target = (
self.parse_register(instruction, instruction.op_find(CS_OP_REG, 1), emu) instruction.op_find(CS_OP_REG, 1).before_value
+ instruction.op_find(CS_OP_IMM, 1).imm + instruction.op_find(CS_OP_IMM, 1).imm
) & ptrmask ) & ptrmask
# Clear the lowest bit without knowing the register width # Clear the lowest bit without knowing the register width

Loading…
Cancel
Save