Code does NOT need to be word-aligned based on ROM data

This commit is contained in:
DataHoarder 2020-12-25 21:08:56 +01:00
parent a40bcbd559
commit ffb7f37d7a

View file

@ -206,7 +206,9 @@ void ImageFormat::decodeAnalyzeInstructionsAt(uint32_t offset) {
do{
if(state.current >= 0x100000 || state.current % 4 != 0){
jumpsUsed[state.current] = true;
if(state.current >= 0x100000 || (findInstructionByAddress(state.current) == nullptr && findInstructionByAddress(state.current, true) != nullptr)){ //Prevent arbitrary decoding in between decoded instructions
break;
}else if(findInstructionByAddress(state.current) == nullptr){
auto decodedInstruction = Instruction::Instruction::decodeInstructionFromBytes(state.current, baseImage);
@ -218,8 +220,6 @@ void ImageFormat::decodeAnalyzeInstructionsAt(uint32_t offset) {
}
jumpsUsed[state.current] = true;
state.previous = state.current;
auto& instruction = findInstructionByAddress(state.current);
@ -291,7 +291,7 @@ void ImageFormat::decodeAnalyzeInstructionsAt(uint32_t offset) {
if(savedStates.empty()){
for(auto& visited : jumpsUsed){
if(!visited.second && visited.first >= offset && visited.first <= 0x100000 && visited.first % 4 == 0){
if(!visited.second && visited.first >= offset && visited.first <= 0x100000){
baseState.current = visited.first;
savedStates.push(baseState);
break;