aboutsummaryrefslogtreecommitdiff
path: root/hw/riscv
diff options
context:
space:
mode:
authorKONRAD Frederic <frederic.konrad@adacore.com>2018-05-03 17:17:14 +0200
committerMichael Clark <mjc@sifive.com>2018-05-09 07:57:32 +1200
commit17b9751e85b9989cc841ed387794d7f1e8aa5e46 (patch)
treeba35d51a3046feee602ab5bdf2936b6dfc6afcf5 /hw/riscv
parentc8b7e627b4269a3bc3ae41d9f420547a47e6d9b9 (diff)
riscv: spike: allow base == 0
The sanity check on base doesn't allow htif to be mapped @0. Check if the symbol exists instead so we can map it where we want. Reviewed-by: Michael Clark <mjc@sifive.com> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com> Signed-off-by: Michael Clark <mjc@sifive.com> Message-Id: <1525360636-18229-2-git-send-email-frederic.konrad@adacore.com>
Diffstat (limited to 'hw/riscv')
-rw-r--r--hw/riscv/riscv_htif.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/riscv/riscv_htif.c b/hw/riscv/riscv_htif.c
index 3e17f30251..be252ec8cc 100644
--- a/hw/riscv/riscv_htif.c
+++ b/hw/riscv/riscv_htif.c
@@ -41,17 +41,20 @@
} while (0)
static uint64_t fromhost_addr, tohost_addr;
+static int address_symbol_set;
void htif_symbol_callback(const char *st_name, int st_info, uint64_t st_value,
- uint64_t st_size)
+ uint64_t st_size)
{
if (strcmp("fromhost", st_name) == 0) {
+ address_symbol_set |= 1;
fromhost_addr = st_value;
if (st_size != 8) {
error_report("HTIF fromhost must be 8 bytes");
exit(1);
}
} else if (strcmp("tohost", st_name) == 0) {
+ address_symbol_set |= 2;
tohost_addr = st_value;
if (st_size != 8) {
error_report("HTIF tohost must be 8 bytes");
@@ -248,7 +251,7 @@ HTIFState *htif_mm_init(MemoryRegion *address_space, MemoryRegion *main_mem,
qemu_chr_fe_init(&s->chr, chr, &error_abort);
qemu_chr_fe_set_handlers(&s->chr, htif_can_recv, htif_recv, htif_event,
htif_be_change, s, NULL, true);
- if (base) {
+ if (address_symbol_set == 3) {
memory_region_init_io(&s->mmio, NULL, &htif_mm_ops, s,
TYPE_HTIF_UART, size);
memory_region_add_subregion(address_space, base, &s->mmio);