diff --git a/src/platform/qemu-riscv32-virt/inc b/src/platform/qemu-riscv32-virt/inc new file mode 120000 index 000000000..728cc03bd --- /dev/null +++ b/src/platform/qemu-riscv32-virt/inc @@ -0,0 +1 @@ +../qemu-riscv64-virt/inc \ No newline at end of file diff --git a/src/platform/qemu-riscv32-virt/objects.mk b/src/platform/qemu-riscv32-virt/objects.mk new file mode 120000 index 000000000..9f389cff2 --- /dev/null +++ b/src/platform/qemu-riscv32-virt/objects.mk @@ -0,0 +1 @@ +../qemu-riscv64-virt/objects.mk \ No newline at end of file diff --git a/src/platform/qemu-riscv32-virt/platform.mk b/src/platform/qemu-riscv32-virt/platform.mk new file mode 100644 index 000000000..b1281a8a0 --- /dev/null +++ b/src/platform/qemu-riscv32-virt/platform.mk @@ -0,0 +1,2 @@ +ARCH_SUB:=riscv32 +include $(current_directory)/../qemu-riscv64-virt/platform.mk diff --git a/src/platform/qemu-riscv32-virt/virt_desc.c b/src/platform/qemu-riscv32-virt/virt_desc.c new file mode 120000 index 000000000..3b3bc7e6f --- /dev/null +++ b/src/platform/qemu-riscv32-virt/virt_desc.c @@ -0,0 +1 @@ +../qemu-riscv64-virt/virt_desc.c \ No newline at end of file diff --git a/src/platform/qemu-riscv64-virt/virt_desc.c b/src/platform/qemu-riscv64-virt/virt_desc.c index fc982299b..8313e234b 100644 --- a/src/platform/qemu-riscv64-virt/virt_desc.c +++ b/src/platform/qemu-riscv64-virt/virt_desc.c @@ -6,6 +6,15 @@ #include #include +#if RV32 +// We use only 1 GiB for the rv32, due to limitations on how the physical memory must +// be identity mapped by the hypervisor and the fact that the hypervisor reserves for +// itsel the upper GB of the 4GB address space. +#define QEMU_VIRT_MEM_REG_SIZE (0x40000000 - 0x200000) +#else +#define QEMU_VIRT_MEM_REG_SIZE (0x100000000 - 0x200000) +#endif + struct platform platform = { .cpu_num = 4, @@ -14,7 +23,7 @@ struct platform platform = { .regions = (struct mem_region[]) { { .base = 0x80200000, - .size = 0x100000000 - 0x200000, + .size = QEMU_VIRT_MEM_REG_SIZE, }, },