4 Commits

2 changed files with 4 additions and 9 deletions

View File

@ -399,6 +399,7 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
CPPLOG(INFO) << "tohost send '" << io_buf.str() << "'";
}
}
std::unordered_map<std::string, uint64_t> symbol_table;
uint64_t entry_address{0};
uint64_t tohost = std::numeric_limits<uint64_t>::max();

View File

@ -40,14 +40,8 @@ private:
std::copy(data, data + length, p.data() + (addr & mem.page_addr_mask));
// this->tohost handling in case of riscv-test
// according to https://github.com/riscv-software-src/riscv-isa-sim/issues/364#issuecomment-607657754:
if(access && iss::access_type::FUNC) {
if(addr == hart_if.tohost) {
return hart_if.exec_htif(data);
}
if((WORD_LEN == 32 && addr == hart_if.fromhost + 4) || (WORD_LEN == 64 && addr == hart_if.fromhost)) {
uint64_t fhostvar = *reinterpret_cast<uint64_t*>(p.data() + (hart_if.fromhost & mem.page_addr_mask));
*reinterpret_cast<uint64_t*>(p.data() + (hart_if.tohost & mem.page_addr_mask)) = fhostvar;
}
if(access && iss::access_type::FUNC && addr == hart_if.tohost) {
return hart_if.exec_htif(data);
}
return iss::Ok;
}
@ -59,4 +53,4 @@ protected:
};
} // namespace mmio
} // namespace iss
#endif // _MEMORY_WITH_HTIF_
#endif // _MEMORY_WITH_HTIF_