changes the io_buf
This commit is contained in:
parent
23842742a6
commit
88475bfa55
@ -394,11 +394,16 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
csr_wr_cb[minstreth] = MK_CSR_WR_CB(write_instret);
|
csr_wr_cb[minstreth] = MK_CSR_WR_CB(write_instret);
|
||||||
csr_rd_cb[mhartid] = MK_CSR_RD_CB(read_hartid);
|
csr_rd_cb[mhartid] = MK_CSR_RD_CB(read_hartid);
|
||||||
};
|
};
|
||||||
~riscv_hart_common() {};
|
~riscv_hart_common() {
|
||||||
|
if(io_buf.str().length()) {
|
||||||
|
CPPLOG(INFO) << "tohost send '" << io_buf.str() << "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
std::unordered_map<std::string, uint64_t> symbol_table;
|
std::unordered_map<std::string, uint64_t> symbol_table;
|
||||||
uint64_t entry_address{0};
|
uint64_t entry_address{0};
|
||||||
uint64_t tohost = std::numeric_limits<uint64_t>::max();
|
uint64_t tohost = std::numeric_limits<uint64_t>::max();
|
||||||
uint64_t fromhost = std::numeric_limits<uint64_t>::max();
|
uint64_t fromhost = std::numeric_limits<uint64_t>::max();
|
||||||
|
std::stringstream io_buf;
|
||||||
|
|
||||||
void set_semihosting_callback(semihosting_cb_t<reg_t> cb) { semihosting_cb = cb; };
|
void set_semihosting_callback(semihosting_cb_t<reg_t> cb) { semihosting_cb = cb; };
|
||||||
|
|
||||||
@ -465,7 +470,6 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
};
|
};
|
||||||
|
|
||||||
iss::status execute_sys_write(arch_if* aif, const std::array<uint64_t, 8>& loaded_payload, unsigned mem_type) {
|
iss::status execute_sys_write(arch_if* aif, const std::array<uint64_t, 8>& loaded_payload, unsigned mem_type) {
|
||||||
std::stringstream io_buf;
|
|
||||||
uint64_t fd = loaded_payload[1];
|
uint64_t fd = loaded_payload[1];
|
||||||
uint64_t buf_ptr = loaded_payload[2];
|
uint64_t buf_ptr = loaded_payload[2];
|
||||||
uint64_t len = loaded_payload[3];
|
uint64_t len = loaded_payload[3];
|
||||||
@ -476,15 +480,13 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
}
|
}
|
||||||
// we disregard the fd and just log to stdout
|
// we disregard the fd and just log to stdout
|
||||||
for(size_t i = 0; i < len; i++) {
|
for(size_t i = 0; i < len; i++) {
|
||||||
if(buf[i] == '\n') {
|
if(buf[i] == '\n' || buf[i] == '\0') {
|
||||||
CPPLOG(INFO) << "tohost send '" << io_buf.str() << "'";
|
CPPLOG(INFO) << "tohost send '" << io_buf.str() << "'";
|
||||||
io_buf.str("");
|
io_buf.str("");
|
||||||
} else
|
} else
|
||||||
io_buf << buf[i];
|
io_buf << buf[i];
|
||||||
}
|
}
|
||||||
if(io_buf.str().length()) {
|
|
||||||
CPPLOG(INFO) << "tohost send '" << io_buf.str() << "'";
|
|
||||||
}
|
|
||||||
// Not sure what the correct return value should be
|
// Not sure what the correct return value should be
|
||||||
uint8_t ret_val = 1;
|
uint8_t ret_val = 1;
|
||||||
if(fromhost != std::numeric_limits<uint64_t>::max())
|
if(fromhost != std::numeric_limits<uint64_t>::max())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user