File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ CFLAGS = -std=gnu99 -O2 -Wall -Wextra
1111CFLAGS += -Wno-unused-label
1212CFLAGS += -include src/common.h
1313
14+ # In the system test suite, the executable is an ELF file.
15+ # However, the Linux kernel emulation includes the Image, DT, and
16+ # root filesystem (rootfs). Therefore, the test suite needs this
17+ # flag to load the ELF and differentiate it from the kernel emulation.
18+ USE_ELF ?= 0
19+
1420ENABLE_SYSTEM ?= 0
1521$(call set-feature, SYSTEM)
1622
Original file line number Diff line number Diff line change @@ -225,14 +225,14 @@ int main(int argc, char **args)
225225 .cycle_per_step = CYCLE_PER_STEP ,
226226 .allow_misalign = opt_misaligned ,
227227 };
228- #if RV32_HAS (SYSTEM )
229- assert (attr .data .system );
230- attr .data .system -> kernel = "build/Image" ; /* FIXME: hardcoded */
231- attr .data .system -> initrd = "build/rootfs.cpio" ; /* FIXME: hardcoded */
232- attr .data .system -> dtb = "build/minimal.dtb" ; /* FIXME: hardcoded */
233- #else
228+ #if defined(USE_ELF )
234229 assert (attr .data .user );
235230 attr .data .user -> elf_program = opt_prog_name ;
231+ #elif RV32_HAS (SYSTEM )
232+ assert (attr .data .system );
233+ attr .data .system -> kernel = "build/Image" ; /* FIXME: hardcoded */
234+ attr .data .system -> initrd = "build/rootfs.cpio" ;/* FIXME: hardcoded */
235+ attr .data .system -> dtb = "build/minimal.dtb" ;/* FIXME: hardcoded */
236236#endif
237237
238238 /* create the RISC-V runtime */
Original file line number Diff line number Diff line change @@ -306,6 +306,10 @@ riscv_t *rv_create(riscv_user_t rv_attr)
306306
307307 elf_delete (elf );
308308
309+ #if RV32_HAS (SYSTEM )
310+ /* install the MMU I/O handlers */
311+ memcpy (& rv -> io , & mmu_io , sizeof (riscv_io_t ));
312+ #else
309313 /* install the I/O handlers */
310314 const riscv_io_t io = {
311315 /* memory read interface */
@@ -327,8 +331,9 @@ riscv_t *rv_create(riscv_user_t rv_attr)
327331 .on_trap = trap_handler ,
328332 };
329333 memcpy (& rv -> io , & io , sizeof (riscv_io_t ));
334+ #endif /* RV32_HAS(SYSTEM) */
330335 }
331- #if RV32_HAS (SYSTEM )
336+ #if RV32_HAS (SYSTEM ) && !defined( USE_ELF )
332337 else {
333338 /* *-----------------------------------------*
334339 * | Memory layout |
You can’t perform that action at this time.
0 commit comments