Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-1078_ghidorahrex_ARMEmulation_no_thumb'

ghidra199d0e9825696
diff --cc Ghidra/Processors/ARM/src/main/java/ghidra/program/emulation/ARMEmulateInstructionStateModifier.java
index 6ae2e7d387,460d2d4153..f5ce6859d7
--- a/Ghidra/Processors/ARM/src/main/java/ghidra/program/emulation/ARMEmulateInstructionStateModifier.java
+++ b/Ghidra/Processors/ARM/src/main/java/ghidra/program/emulation/ARMEmulateInstructionStateModifier.java
@@@ -36,12 -36,12 +36,12 @@@ public class ARMEmulateInstructionState
public ARMEmulateInstructionStateModifier(Emulate emu) {
super(emu);
TModeReg = language.getRegister("TMode");
-- TBreg = language.getRegister("ISAModeSwitch");
- if (TModeReg != null && TBreg == null) {
- throw new RuntimeException(
- "Expected language " + language.getLanguageID() + " to have TB register defined");
- }
++ TBreg = language.getRegister("ISAModeSwitch"); // generic register which mirrors TB register value
if (TModeReg != null) {
+ if (TBreg == null) {
+ throw new RuntimeException("Expected language " + language.getLanguageID() +
- " to have TB register defined");
++ " to have ISAModeSwitch register defined");
+ }
tMode = new RegisterValue(TModeReg, BigInteger.ONE);
aMode = new RegisterValue(TModeReg, BigInteger.ZERO);
}
@@@ -116,13 -116,15 +116,14 @@@
* Initialize TB register based upon context-register state before first instruction is executed.
*/
@Override
- public void initialExecuteCallback(Emulate emulate, Address current_address,
- RegisterValue contextRegisterValue) throws LowlevelError {
- BigInteger tModeValue = BigInteger.ZERO;
+ public void initialExecuteCallback(Emulate emulate, Address current_address, RegisterValue contextRegisterValue) throws LowlevelError {
if (TModeReg == null) {
- return;
+ return; // Thumb mode not supported
}
+ BigInteger tModeValue = BigInteger.ZERO;
if (contextRegisterValue != null) {
- tModeValue = contextRegisterValue.getRegisterValue(TModeReg).getUnsignedValueIgnoreMask();
+ tModeValue =
+ contextRegisterValue.getRegisterValue(TModeReg).getUnsignedValueIgnoreMask();
}
if (!BigInteger.ZERO.equals(tModeValue)) {
tModeValue = BigInteger.ONE;