+ // TODO: Move this into its own packet sending class?
+ // Add the given message to send_buf.
+ void send(const char* msg);
+ // Hex-encode a 64-bit value, and send it to gcc in target byte order (little
+ // endian).
+ void send(uint64_t value);
+ // Hex-encode a 32-bit value, and send it to gcc in target byte order (little
+ // endian).
+ void send(uint32_t value);
+ // Hex-encode an 8-bit value, and send it to gcc.
+ void send(uint8_t value);
+ void send_packet(const char* data);
+ uint8_t running_checksum;
+ // Send "$" and clear running checksum.
+ void start_packet();
+ // Send "#" and checksum.
+ void end_packet(const char* data=NULL);
+
+ // Write value to the index'th word in Debug RAM.
+ void dr_write32(unsigned int index, uint32_t value);
+ void dr_write64(unsigned int index, uint64_t value);
+ void dr_write(enum slot slot, uint64_t value);
+ // Write jump-to-resume instruction to the index'th word in Debug RAM.
+ void dr_write_jump(unsigned int index);
+ // Write an xlen-bit store instruction.
+ void dr_write_store(unsigned int index, unsigned int reg, enum slot);
+ void dr_write_load(unsigned int index, unsigned int reg, enum slot);
+ uint32_t dr_read32(unsigned int index);
+ uint64_t dr_read64(unsigned int index);
+ uint64_t dr_read(enum slot slot);
+
+ // Return access size to use when writing length bytes to address, so that
+ // every write will be aligned.
+ unsigned int find_access_size(reg_t address, int length);
+
+ void set_interrupt(uint32_t hartid);
+
+ // Members that ought to be privated, but that we'd really like to access
+ // from operation classes.
+ reg_t dpc;
+ reg_t dcsr;
+ reg_t mstatus;
+ reg_t sptbr;
+ bool sptbr_valid;
+ reg_t tselect;
+ bool tselect_valid;
+ bool fence_i_required;
+
+ std::map<reg_t, reg_t> pte_cache;
+
+ reg_t translate(reg_t vaddr);
+ // Return the PRV_x that is used when the code under debug performs a memory
+ // access.
+ unsigned int privilege_mode();
+ // Return the VM_x that is used when the code under debug performs a memory
+ // access.
+ unsigned int virtual_memory();
+
+ unsigned int xlen;
+
+ std::set<hardware_breakpoint_t, hardware_breakpoint_compare_t>
+ hardware_breakpoints;