Added interrupt handler known jump and parsing when found
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f5ce6a92ce
commit
0caa10273e
|
@ -79,3 +79,10 @@ uint32_t AnalysisState::getDefaultRegisterValue(uint32_t addr) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AnalysisState::setRegister(uint32_t addr, uint32_t value) {
|
||||
if(addr == (uint32_t)KnownRegisters::BSM_ARGS){
|
||||
addKnownJump(value & 0xFFFFFF, current, JumpKind::Interrupt);
|
||||
}
|
||||
memory[addr] = value;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ enum class JumpKind {
|
|||
Speculative,
|
||||
Branch,
|
||||
Loop,
|
||||
Return
|
||||
Return,
|
||||
Interrupt
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32_t, std::vector<std::pair<uint32_t, JumpKind>>> AnalysisJumpTable;
|
||||
|
@ -84,9 +85,7 @@ public:
|
|||
|
||||
void setRegister(const Instruction::AddressWithOffset &address, uint32_t value);
|
||||
|
||||
void setRegister(uint32_t addr, uint32_t value) {
|
||||
memory[addr] = value;
|
||||
}
|
||||
void setRegister(uint32_t addr, uint32_t value);
|
||||
|
||||
uint32_t getRegister(const Instruction::AddressWithOffset &address) const;
|
||||
|
||||
|
|
|
@ -250,6 +250,13 @@ void ImageFormat::decodeAnalyzeInstructionsAt(uint32_t offset) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
//Handle interrupts
|
||||
uint32_t addr = state.getRegister((uint32_t) KnownRegisters::BSM_ARGS) & 0xFFFFFF;
|
||||
if(addr != 0 && jumpsUsed.find(addr) == jumpsUsed.end()){
|
||||
jumpsUsed[addr] = false;
|
||||
}
|
||||
|
||||
if (instruction->getCommand() == Instruction::Instruction::CommandOp::JUMP) {
|
||||
uint32_t nextAddress = instruction->getAddress() - 1;
|
||||
while (true) {
|
||||
|
|
|
@ -115,6 +115,9 @@ void OutputContext::analyze() {
|
|||
case JumpKind::Return:
|
||||
from << "Return";
|
||||
break;
|
||||
case JumpKind::Interrupt:
|
||||
from << "Interrupt";
|
||||
break;
|
||||
}
|
||||
from << "), ";
|
||||
} else {
|
||||
|
|
|
@ -108,8 +108,6 @@ Instruction::Write::execute(AnalysisState &state) const {
|
|||
|
||||
state.addKnownJump(getEndAddress(), getAddress(), JumpKind::Continue);
|
||||
|
||||
state.addKnownJump(getEndAddress(), getAddress(), JumpKind::Continue);
|
||||
|
||||
return std::vector<std::pair<uint32_t, std::unordered_map<uint32_t, uint32_t>>>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue