mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-26 19:05:31 +08:00
GT-2880 set thumb on mem; fix exception handling under thumb
This commit is contained in:
@@ -473,14 +473,21 @@ public class PeLoader extends AbstractPeDebugLoader {
|
||||
private void setProcessorContext(FileHeader fileHeader, Program program, TaskMonitor monitor,
|
||||
MessageLog log) {
|
||||
|
||||
String machineName = fileHeader.getMachineName();
|
||||
if ("450".equals(machineName) || "452".equals(machineName)) {
|
||||
Register tmodeReg = program.getProgramContext().getRegister("TMode");
|
||||
if (tmodeReg == null) {
|
||||
return;
|
||||
try {
|
||||
String machineName = fileHeader.getMachineName();
|
||||
if ("450".equals(machineName) || "452".equals(machineName)) {
|
||||
Register tmodeReg = program.getProgramContext().getRegister("TMode");
|
||||
if (tmodeReg == null) {
|
||||
return;
|
||||
}
|
||||
RegisterValue thumbMode = new RegisterValue(tmodeReg, BigInteger.ONE);
|
||||
AddressSpace space = program.getAddressFactory().getDefaultAddressSpace();
|
||||
program.getProgramContext().setRegisterValue(space.getMinAddress(),
|
||||
space.getMaxAddress(), thumbMode);
|
||||
}
|
||||
RegisterValue thumbMode = new RegisterValue(tmodeReg, BigInteger.ONE);
|
||||
program.getProgramContext().setDefaultDisassemblyContext(thumbMode);
|
||||
}
|
||||
catch (ContextChangeException e) {
|
||||
throw new AssertException("instructions should not exist");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -17,6 +17,7 @@ package ghidra.app.cmd.data;
|
||||
|
||||
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
||||
import ghidra.app.cmd.function.CreateFunctionCmd;
|
||||
import ghidra.app.util.PseudoDisassembler;
|
||||
import ghidra.app.util.datatype.microsoft.DataApplyOptions;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressOutOfBoundsException;
|
||||
@@ -323,6 +324,8 @@ public class EHDataTypeUtilities {
|
||||
public static boolean createFunctionIfNeeded(Program program, Address functionAddress) {
|
||||
// If there isn't an instruction at the function address yet, then disassemble there.
|
||||
Listing listing = program.getListing();
|
||||
functionAddress =
|
||||
PseudoDisassembler.getNormalizedDisassemblyAddress(program, functionAddress);
|
||||
Instruction inst = listing.getInstructionAt(functionAddress);
|
||||
if (inst == null) {
|
||||
DisassembleCommand cmd = new DisassembleCommand(functionAddress, null, true);
|
||||
|
||||
Reference in New Issue
Block a user