diff options
author | Clément Léger <cleger@rivosinc.com> | 2024-05-15 17:15:40 +0200 |
---|---|---|
committer | Clément Léger <cleger@rivosinc.com> | 2024-05-29 14:20:20 +0200 |
commit | a316a37331aaaa4c8905ba37a86bde42a2c75343 (patch) | |
tree | 2bac0c1b3e4c2cdc65183ea1b97ce3433f767b8d /fesvr/htif.h | |
parent | c81d8e73daf1875d79a54f28f67df150fba0e44c (diff) | |
download | spike-a316a37331aaaa4c8905ba37a86bde42a2c75343.zip spike-a316a37331aaaa4c8905ba37a86bde42a2c75343.tar.gz spike-a316a37331aaaa4c8905ba37a86bde42a2c75343.tar.bz2 |
add support to load ET_DYN elf
When compiled as PIE, executable can be loaded at any memory address.
Lately, OpenSBI switched to such behavior and spike was not able to load
it anymore. This patch add an additional load_offset parameter for
load_elf(). This load_offset value is passed as DRAM_BASE and used only
for ET_DYN elfs.
Signed-off-by: Clément Léger <cleger@rivosinc.com>
Diffstat (limited to 'fesvr/htif.h')
-rw-r--r-- | fesvr/htif.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fesvr/htif.h b/fesvr/htif.h index dd7c060..74511f5 100644 --- a/fesvr/htif.h +++ b/fesvr/htif.h @@ -7,6 +7,7 @@ #include "syscall.h" #include "device.h" #include "byteorder.h" +#include "../riscv/platform.h" #include <string.h> #include <map> #include <vector> @@ -58,7 +59,8 @@ class htif_t : public chunked_memif_t virtual size_t chunk_align() = 0; virtual size_t chunk_max_size() = 0; - virtual std::map<std::string, uint64_t> load_payload(const std::string& payload, reg_t* entry); + virtual std::map<std::string, uint64_t> load_payload(const std::string& payload, reg_t* entry, + reg_t load_addr); virtual void load_program(); virtual void idle() {} @@ -79,6 +81,7 @@ class htif_t : public chunked_memif_t void register_devices(); void usage(const char * program_name); unsigned int expected_xlen = 0; + const reg_t load_offset = DRAM_BASE; memif_t mem; reg_t entry; bool writezeros; |