1 // See LICENSE for license details.
2 #ifndef _RISCV_DEBUG_MODULE_H
3 #define _RISCV_DEBUG_MODULE_H
45 CMDERR_HALTRESUME
= 4,
51 unsigned autoexecprogbuf
;
52 unsigned autoexecdata
;
55 class debug_module_data_t
: public abstract_device_t
58 debug_module_data_t();
60 bool load(reg_t addr
, size_t len
, uint8_t* bytes
);
61 bool store(reg_t addr
, size_t len
, const uint8_t* bytes
);
63 uint32_t read32(reg_t addr
) const;
64 void write32(reg_t addr
, uint32_t value
);
66 uint8_t data
[DEBUG_EXCHANGE_SIZE
];
69 class debug_module_t
: public abstract_device_t
72 debug_module_t(sim_t
*sim
);
74 void add_device(bus_t
*bus
);
76 bool load(reg_t addr
, size_t len
, uint8_t* bytes
);
77 bool store(reg_t addr
, size_t len
, const uint8_t* bytes
);
79 // Debug Module Interface that the debugger (in our case through JTAG DTM)
80 // uses to access the DM.
81 // Return true for success, false for failure.
82 bool dmi_read(unsigned address
, uint32_t *value
);
83 bool dmi_write(unsigned address
, uint32_t value
);
86 static const unsigned progsize
= 8;
90 uint8_t debug_rom_entry
[DEBUG_ROM_ENTRY_SIZE
];
91 uint8_t debug_rom_code
[DEBUG_ROM_CODE_SIZE
];
92 uint8_t debug_rom_exception
[DEBUG_ROM_EXCEPTION_SIZE
];
93 uint8_t program_buffer
[progsize
* 4];
95 debug_module_data_t dmdata
;
96 // Instruction that will be placed at the current hart's ROM entry address
97 // after the current action has completed.
101 void write32(uint8_t *rom
, unsigned int index
, uint32_t value
);
102 uint32_t read32(uint8_t *rom
, unsigned int index
);
104 dmcontrol_t dmcontrol
;
106 abstractcs_t abstractcs
;
107 abstractauto_t abstractauto
;
110 processor_t
*current_proc() const;
112 bool perform_abstract_command();