T32: Evalute memory map, RangeListener, MemAccess

This commit is contained in:
Martin Hoffmann
2013-02-17 21:41:30 +01:00
parent e66ae5e691
commit 447411da9a
5 changed files with 217 additions and 54 deletions

View File

@ -17,7 +17,7 @@ aspect T32Listener
bool onAddition()
{
// Setup Breakpoint in T32
return T32_WriteBreakpoint( m_WatchInstrPtr, T32::MEMACCESS::PROGRAM, T32::BP::EXECUTION, 1) == 0;
return T32_WriteBreakpoint( m_WatchInstrPtr, T32::MEMACCESS::PROGRAM, T32::BP::EXECUTION /* | T32::BP::READ ?? */, 1) == 0;
}
void onDeletion()
@ -27,6 +27,53 @@ aspect T32Listener
// TODO Error handling
}
};
advice "fail::BPRangeListener" : slice class
{
public:
bool onAddition()
{
// Calculate address range
address_t range = m_WatchEndAddr - m_WatchStartAddr; // range / sizeof(address_t) ??!
// Setup Breakpoint in T32
return T32_WriteBreakpoint( m_WatchStartAddr, T32::MEMACCESS::PROGRAM, T32::BP::EXECUTION, range) == 0;
}
void onDeletion()
{
// Calculate address range
address_t range = m_WatchEndAddr - m_WatchStartAddr; // range / sizeof(address_t) ??!
// Setup Breakpoint in T32
T32_WriteBreakpoint( m_WatchStartAddr, T32::MEMACCESS::PROGRAM, T32::BP::CLEAR, range);
// TODO Error handling
}
};
advice "fail::MemAccessListener" : slice class
{
int m_t32access;
public:
bool onAddition()
{
// Setup Breakpoint in T32
switch(m_WatchType) {
case MemAccessEvent::MEM_READ: m_t32access = T32::BP::READ; break;
case MemAccessEvent::MEM_WRITE: m_t32access = T32::BP::WRITE; break;
case MemAccessEvent::MEM_READWRITE: m_t32access = (T32::BP::READ | T32::BP::WRITE); break;
default: return false;
}
return T32_WriteBreakpoint( m_WatchAddr, T32::MEMACCESS::DATA, m_t32access, m_WatchWidth) == 0;
}
void onDeletion()
{
// Setup Breakpoint in T32
T32_WriteBreakpoint( m_WatchAddr, T32::MEMACCESS::DATA, m_t32access, m_WatchWidth);
// TODO Error handling
}
};
};
#endif // BUILD_T32 && CONFIG_EVENT_BREAKPOINTS

View File

@ -39,19 +39,33 @@ bool VEZSExperiment::run()
mm.setByte(targetaddress, 0x42);
mm.getByte(targetaddress);
uint8_t tb[] = {0xaa, 0xbb, 0xcc, 0xdd};
uint8_t tb[] = {0xab, 0xbb, 0xcc, 0xdd};
mm.setBytes(targetaddress, 4, tb);
*((uint32_t*)(tb)) = 0; // clear array.
// read back bytes
mm.getBytes(targetaddress, 4, tb);
// Test Breakpoints
address_t address = 0x11223344;
// Test Listeners
address_t address = 0xee;
BPSingleListener bp(address);
simulator.addListener(&bp);
simulator.clearListeners();
BPRangeListener rbp(0xef, 0xff);
simulator.addListener(&rbp);
MemAccessListener l_mem_w(0x1111, MemAccessEvent::MEM_WRITE);
l_mem_w.setWatchWidth(16);
simulator.addListener(&l_mem_w);
MemAccessListener l_mem_r(0x2222, MemAccessEvent::MEM_READ);
l_mem_r.setWatchWidth(16);
simulator.addListener(&l_mem_r);
MemAccessListener l_mem_rw(0x3333, MemAccessEvent::MEM_READWRITE);
l_mem_rw.setWatchWidth(16);
simulator.addListener(&l_mem_rw);
simulator.clearListeners();
// resume backend.
// simulator.resume();