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
11
11
CFLAGS += -Wno-unused-label
12
12
CFLAGS += -include src/common.h
13
13
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
+
14
20
ENABLE_SYSTEM ?= 0
15
21
$(call set-feature, SYSTEM)
16
22
Original file line number Diff line number Diff line change @@ -225,14 +225,14 @@ int main(int argc, char **args)
225
225
.cycle_per_step = CYCLE_PER_STEP ,
226
226
.allow_misalign = opt_misaligned ,
227
227
};
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 )
234
229
assert (attr .data .user );
235
230
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 */
236
236
#endif
237
237
238
238
/* 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)
306
306
307
307
elf_delete (elf );
308
308
309
+ #if RV32_HAS (SYSTEM )
310
+ /* install the MMU I/O handlers */
311
+ memcpy (& rv -> io , & mmu_io , sizeof (riscv_io_t ));
312
+ #else
309
313
/* install the I/O handlers */
310
314
const riscv_io_t io = {
311
315
/* memory read interface */
@@ -327,8 +331,9 @@ riscv_t *rv_create(riscv_user_t rv_attr)
327
331
.on_trap = trap_handler ,
328
332
};
329
333
memcpy (& rv -> io , & io , sizeof (riscv_io_t ));
334
+ #endif /* RV32_HAS(SYSTEM) */
330
335
}
331
- #if RV32_HAS (SYSTEM )
336
+ #if RV32_HAS (SYSTEM ) && !defined( USE_ELF )
332
337
else {
333
338
/* *-----------------------------------------*
334
339
* | Memory layout |
You can’t perform that action at this time.
0 commit comments