memcpy(raw_page + addr - DEBUG_START, bytes, len);
return true;
} else if (len == 4 && addr == DEBUG_CLEARDEBINT) {
- clear_interrupt(bytes[4] | (bytes[5] << 8) |
- (bytes[6] << 16) | (bytes[7] << 24));
+ clear_interrupt(bytes[0] | (bytes[1] << 8) |
+ (bytes[2] << 16) | (bytes[3] << 24));
return true;
}
base[3] = (value >> 24) & 0xff;
}
+uint32_t debug_module_t::ram_read32(unsigned int index)
+{
+ char* base = raw_page + DEBUG_RAM_START - DEBUG_START + index * 4;
+ return base[0] |
+ (base[1] << 8) |
+ (base[2] << 16) |
+ (base[3] << 24);
+}
+
char* debug_module_t::page(reg_t paddr)
{
fprintf(stderr, "dm::page(0x%lx)\n", paddr);
char* page(reg_t paddr);
void ram_write32(unsigned int index, uint32_t value);
+ uint32_t ram_read32(unsigned int index);
void set_interrupt(uint32_t hartid) {
interrupt.insert(hartid);
sim->debug_module.ram_write32(index, value);
}
+uint32_t gdbserver_t::read_debug_ram(unsigned int index)
+{
+ return sim->debug_module.ram_read32(index);
+}
+
void gdbserver_t::halt()
{
processor_t *p = sim->get_core(0);
if (state == STATE_HALTING && sim->debug_module.get_interrupt(p->id) == 0) {
// gdb requested a halt and now it's done.
send_packet("T05");
+ fprintf(stderr, "DPC: 0x%x\n", read_debug_ram(0));
+ fprintf(stderr, "DCSR: 0x%x\n", read_debug_ram(2));
state = STATE_HALTED;
}
// Write value to the index'th word in Debug RAM.
void write_debug_ram(unsigned int index, uint32_t value);
+ uint32_t read_debug_ram(unsigned int index);
};
#endif