For the T32 variant we have to evaluate the memory access instruction to find out, which memory address was accessed. Dissassmbly by OpenOCDs arm_disassembler.hpp/.cc: - fine for ARM / Thumb1 - needs fixes for Thumb2 :( (currently doing that..)
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#ifndef __MEMORYINSTRUCTION_HPP__
|
|
#define __MEMORYINSTRUCTION_HPP__
|
|
|
|
#include <string>
|
|
#include "SALConfig.hpp"
|
|
|
|
namespace fail {
|
|
|
|
class MemoryInstruction {
|
|
regdata_t address;
|
|
regdata_t value;
|
|
uint8_t width;
|
|
bool writeAccess;
|
|
public:
|
|
MemoryInstruction(regdata_t address = ADDR_INV, regdata_t value = 0, uint8_t width = 0, bool writeAccess = false) :
|
|
address(address), value(value), width(width), writeAccess(writeAccess) { };
|
|
|
|
bool isWriteAccess(void) const { return writeAccess; }
|
|
regdata_t getAddress() const { return address; }
|
|
regdata_t getValue() const { return value; }
|
|
uint8_t getWidth() const { return width; }
|
|
|
|
bool isValid(void) const { return address != ADDR_INV; }
|
|
|
|
void setAddress(regdata_t addr) { address = addr; }
|
|
void setValue(regdata_t val) { value = val; }
|
|
void setWidth(uint8_t w) { width = w; }
|
|
void setWriteAccess(bool iswrite) { writeAccess = iswrite; }
|
|
};
|
|
|
|
class MemoryInstructionAnalyzer {
|
|
public:
|
|
virtual bool eval(address_t opcode, MemoryInstruction & result) = 0;
|
|
};
|
|
|
|
extern MemoryInstructionAnalyzer & meminstruction;
|
|
} // end of namespace fail
|
|
|
|
#endif // __MEMORYINSTRUCTION_HPP__
|
|
|