aboutsummaryrefslogtreecommitdiff
path: root/fesvr
diff options
context:
space:
mode:
authorJerry Zhao <jerryz123@berkeley.edu>2023-03-07 14:23:38 -0800
committerJerry Zhao <jerryz123@berkeley.edu>2023-03-07 22:24:35 -0800
commit76a4414381a7c1e3aee54dd9457641c2b36b982a (patch)
tree77fff0022961e8f85e5eb01564cf35c7cde773fa /fesvr
parent9893d6e939d8ce99106807f424255c59283843ef (diff)
downloadspike-76a4414381a7c1e3aee54dd9457641c2b36b982a.zip
spike-76a4414381a7c1e3aee54dd9457641c2b36b982a.tar.gz
spike-76a4414381a7c1e3aee54dd9457641c2b36b982a.tar.bz2
fesvr: Add symbol_elfs field to htif_t
When populated, symbol_elfs are additional elf files that populate the addr2symbol map in htif
Diffstat (limited to 'fesvr')
-rw-r--r--fesvr/htif.cc16
-rw-r--r--fesvr/htif.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/fesvr/htif.cc b/fesvr/htif.cc
index 89b9224..7abf8b4 100644
--- a/fesvr/htif.cc
+++ b/fesvr/htif.cc
@@ -7,6 +7,7 @@
#include "platform.h"
#include "byteorder.h"
#include "trap.h"
+#include "../riscv/common.h"
#include <algorithm>
#include <assert.h>
#include <vector>
@@ -171,6 +172,21 @@ void htif_t::load_program()
load_payload(payload, &dummy_entry);
}
+ class nop_memif_t : public memif_t {
+ public:
+ nop_memif_t(htif_t* htif) : memif_t(htif), htif(htif) {}
+ void read(addr_t UNUSED addr, size_t UNUSED len, void UNUSED *bytes) override {}
+ void write(addr_t UNUSED taddr, size_t UNUSED len, const void UNUSED *src) override {}
+ private:
+ htif_t* htif;
+ } nop_memif(this);
+
+ reg_t nop_entry;
+ for (auto &s : symbol_elfs) {
+ std::map<std::string, uint64_t> other_symbols = load_elf(s.c_str(), &nop_memif, &nop_entry,
+ expected_xlen);
+ symbols.merge(other_symbols);
+ }
for (auto i : symbols) {
auto it = addr2symbol.find(i.second);
diff --git a/fesvr/htif.h b/fesvr/htif.h
index 18ba766..c6c0a9b 100644
--- a/fesvr/htif.h
+++ b/fesvr/htif.h
@@ -99,6 +99,7 @@ class htif_t : public chunked_memif_t
std::vector<device_t*> dynamic_devices;
std::vector<std::string> payloads;
+ std::vector<std::string> symbol_elfs;
std::map<uint64_t, std::string> addr2symbol;
friend class memif_t;