mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch
'origin/GP-6642_ghidorahrex_HCS12_BRN_fix--SQUASHED' into patch (Closes #9001)
This commit is contained in:
@@ -271,7 +271,7 @@ macro setHCSphysPage(addr) {
|
|||||||
(zext(isPpage) * (0x400000 | ((zext(PPAGE) << 14 ) ^ 0x8000))) +
|
(zext(isPpage) * (0x400000 | ((zext(PPAGE) << 14 ) ^ 0x8000))) +
|
||||||
(zext(isPpage_FF) * (0x400000 | ((0x3FC000) ^ 0xC000))) ;
|
(zext(isPpage_FF) * (0x400000 | ((0x3FC000) ^ 0xC000))) ;
|
||||||
}
|
}
|
||||||
@elif defined(HCS12) && SIZE=="3"
|
@elif defined(HCS12) && SIZE=="3"
|
||||||
macro setHCSphysPage(addr) {
|
macro setHCSphysPage(addr) {
|
||||||
local a3:3 = zext(addr);
|
local a3:3 = zext(addr);
|
||||||
|
|
||||||
@@ -1961,11 +1961,9 @@ with : XGATE=0 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# branch never is a two-byte nop
|
# branch never is a two-byte nop
|
||||||
SkipNextInstr: dest is epsilon [ dest = inst_next + 1; ] { export *[RAM]:1 dest; }
|
|
||||||
|
|
||||||
:BRN SkipNextInstr is Prefix18=0 & op8=0x21 & SkipNextInstr
|
:BRN rel8 is Prefix18=0 & op8=0x21; rel8
|
||||||
{
|
{
|
||||||
goto SkipNextInstr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:BRSET opr8a_8, msk8, rel8 is Prefix18=0 & op8=0x4E; opr8a_8; msk8; rel8
|
:BRSET opr8a_8, msk8, rel8 is Prefix18=0 & op8=0x4E; opr8a_8; msk8; rel8
|
||||||
|
|||||||
@@ -17,19 +17,11 @@ package ghidra.app.plugin.core.analysis;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import ghidra.app.services.AbstractAnalyzer;
|
import ghidra.app.services.*;
|
||||||
import ghidra.app.services.AnalysisPriority;
|
|
||||||
import ghidra.app.services.AnalyzerType;
|
|
||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
import ghidra.program.model.address.AddressSetView;
|
import ghidra.program.model.address.AddressSetView;
|
||||||
import ghidra.program.model.lang.Processor;
|
import ghidra.program.model.lang.*;
|
||||||
import ghidra.program.model.lang.Register;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.lang.RegisterValue;
|
|
||||||
import ghidra.program.model.listing.Function;
|
|
||||||
import ghidra.program.model.listing.FunctionIterator;
|
|
||||||
import ghidra.program.model.listing.Instruction;
|
|
||||||
import ghidra.program.model.listing.InstructionIterator;
|
|
||||||
import ghidra.program.model.listing.Program;
|
|
||||||
import ghidra.program.model.symbol.SourceType;
|
import ghidra.program.model.symbol.SourceType;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
@@ -53,9 +45,8 @@ public class HCS12ConventionAnalyzer extends AbstractAnalyzer {
|
|||||||
public boolean canAnalyze(Program program) {
|
public boolean canAnalyze(Program program) {
|
||||||
// Only analyze HCS-12 / HCS-12X Programs
|
// Only analyze HCS-12 / HCS-12X Programs
|
||||||
Processor processor = program.getLanguage().getProcessor();
|
Processor processor = program.getLanguage().getProcessor();
|
||||||
boolean canDo = "HCS-12".equals(processor.toString()) ||
|
String procName = processor.toString();
|
||||||
"HCS-12X".equals(processor.toString());
|
boolean canDo = "HCS-12".equals(procName) || "HCS-12X".equals(procName);
|
||||||
|
|
||||||
if (canDo) {
|
if (canDo) {
|
||||||
xgate = program.getRegister("XGATE");
|
xgate = program.getRegister("XGATE");
|
||||||
}
|
}
|
||||||
@@ -64,12 +55,13 @@ public class HCS12ConventionAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void checkReturn(Program program, Instruction instr) {
|
void checkReturn(Program program, Instruction instr) {
|
||||||
String mnemonic = instr.getMnemonicString().toLowerCase();
|
|
||||||
|
|
||||||
if (instr == null || !instr.getFlowType().isTerminal()) {
|
if (instr == null || !instr.getFlowType().isTerminal()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mnemonic = instr.getMnemonicString().toLowerCase();
|
||||||
|
|
||||||
// if XGATE set on instruction is XGATE
|
// if XGATE set on instruction is XGATE
|
||||||
RegisterValue xgateValue = program.getProgramContext().getRegisterValue(xgate, instr.getMinAddress());
|
RegisterValue xgateValue = program.getProgramContext().getRegisterValue(xgate, instr.getMinAddress());
|
||||||
if (xgateValue != null && xgateValue.hasValue() && xgateValue.getUnsignedValue().equals(BigInteger.ONE)) {
|
if (xgateValue != null && xgateValue.hasValue() && xgateValue.getUnsignedValue().equals(BigInteger.ONE)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user