Added know NOP instructions to properly handle rrc-as symbols
This commit is contained in:
parent
bf7c3cefe5
commit
2324a561f3
|
@ -52,6 +52,10 @@ std::string OutputContext::getComment(uint32_t location) const {
|
|||
return "";
|
||||
}
|
||||
|
||||
bool OutputContext::isNop(uint32_t location) const {
|
||||
return nop.find(location) != nop.end();
|
||||
}
|
||||
|
||||
|
||||
std::string OutputContext::getDataHeader(uint32_t location) const {
|
||||
std::stringstream s;
|
||||
|
@ -193,6 +197,11 @@ void OutputContext::addComment(uint32_t location, const std::string &comment) {
|
|||
}
|
||||
}
|
||||
|
||||
void OutputContext::setNop(uint32_t location) {
|
||||
|
||||
nop[location] = true;
|
||||
}
|
||||
|
||||
std::string OutputContext::getAddressRegisterName(uint32_t addr, uint8_t offset) const {
|
||||
if (offset || registers.find(addr) == registers.end()) {
|
||||
return ::getAddressRegisterName(addr, offset);
|
||||
|
|
|
@ -42,6 +42,7 @@ private:
|
|||
std::unordered_map<uint32_t, std::string> mappings;
|
||||
std::unordered_map<uint32_t, std::string> comments;
|
||||
std::unordered_map<uint32_t, std::string> registers;
|
||||
std::unordered_map<uint32_t, bool> nop;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -53,6 +54,8 @@ public:
|
|||
|
||||
void addComment(uint32_t location, const std::string &comment);
|
||||
|
||||
void setNop(uint32_t location);
|
||||
|
||||
void addRegister(uint32_t addr, const std::string &name) {
|
||||
registers[addr] = name;
|
||||
}
|
||||
|
@ -69,6 +72,8 @@ public:
|
|||
|
||||
std::string getDataHeader(uint32_t location) const;
|
||||
|
||||
bool isNop(uint32_t location) const;
|
||||
|
||||
std::string getDataEntry(uint32_t location, const std::string &representation = "") const;
|
||||
|
||||
std::string getInstructionString(const Instruction::Instruction &instruction) const;
|
||||
|
|
|
@ -359,6 +359,9 @@ void decodeImage(const std::string &fileName) {
|
|||
functionName.push_back(c);
|
||||
}
|
||||
knownNames[functionStart] = functionName;
|
||||
|
||||
ctx.setNop(loadPointer.getAddress());
|
||||
ctx.setNop(endPointer->getAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +417,9 @@ void decodeImage(const std::string &fileName) {
|
|||
uint32_t prevAddress = 0;
|
||||
for (const auto &entry : imageObject.getInstructions()) {
|
||||
const auto &instruction = entry.second;
|
||||
if (instruction->getAddress() < prevAddress) {
|
||||
if(ctx.isNop(instruction->getAddress())){
|
||||
continue;
|
||||
}else if (instruction->getAddress() < prevAddress) {
|
||||
std::cout << "========== DECODE ERROR? ========== " << std::hex << std::setw(8) << std::setfill('0')
|
||||
<< prevAddress << " - " << std::hex << std::setw(8) << std::setfill('0')
|
||||
<< instruction->getAddress() << "\n";
|
||||
|
|
Loading…
Reference in a new issue