File tree Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Expand file tree Collapse file tree 4 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,11 @@ jobs:
6767 - name : misalignment test in block emulation
6868 run : |
6969 make -C tests/system/alignment/
70- make distclean && make ENABLE_EXT_C=0 ENABLE_SYSTEM=1 misalign-in-blk-emu -j$(nproc)
70+ make distclean && make ENABLE_USE_ELF=1 ENABLE_EXT_C=0 ENABLE_SYSTEM=1 misalign-in-blk-emu -j$(nproc)
7171 - name : MMU test
7272 run : |
7373 make -C tests/system/mmu/
74- make distclean && make ENABLE_SYSTEM=1 mmu-test -j$(nproc)
74+ make distclean && make ENABLE_USE_ELF=1 ENABLE_SYSTEM=1 mmu-test -j$(nproc)
7575 - name : gdbstub test
7676 run : |
7777 make distclean && make ENABLE_GDBSTUB=1 gdbstub-test -j$(nproc)
Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ CFLAGS += -include src/common.h
1515# However, the Linux kernel emulation includes the Image, DT, and
1616# root filesystem (rootfs). Therefore, the test suite needs this
1717# flag to load the ELF and differentiate it from the kernel emulation.
18- USE_ELF ?= 0
18+ ENABLE_USE_ELF ?= 0
19+ ifeq ($(call has, USE_ELF) , 1)
20+ DEFINE_USE_ELF := -DUSE_ELF
21+ endif
1922
2023ENABLE_SYSTEM ?= 0
2124$(call set-feature, SYSTEM)
@@ -248,7 +251,7 @@ endif
248251
249252$(OUT ) /% .o : src/% .c $(deps_emcc )
250253 $(VECHO ) " CC\t$@ \n"
251- $(Q )$(CC ) -o $@ $(CFLAGS ) $(CFLAGS_emcc ) -c -MMD -MF $@ .d $<
254+ $(Q )$(CC ) $( DEFINE_USE_ELF ) -o $@ $(CFLAGS ) $(CFLAGS_emcc ) -c -MMD -MF $@ .d $<
252255
253256$(BIN ) : $(OBJS ) $(DEV_OBJS )
254257 $(VECHO ) " LD\t$@ \n"
Original file line number Diff line number Diff line change @@ -217,22 +217,22 @@ int main(int argc, char **args)
217217 .log_level = 0 ,
218218 .run_flag = run_flag ,
219219 .profile_output_file = prof_out_file ,
220- #if RV32_HAS (SYSTEM )
220+ #if RV32_HAS (SYSTEM ) && ! defined ( USE_ELF )
221221 .data .system = malloc (sizeof (vm_system_t )),
222222#else
223223 .data .user = malloc (sizeof (vm_user_t )),
224224#endif
225225 .cycle_per_step = CYCLE_PER_STEP ,
226226 .allow_misalign = opt_misaligned ,
227227 };
228- #if defined(USE_ELF )
228+ #if RV32_HAS (SYSTEM ) && !defined(USE_ELF )
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
229234 assert (attr .data .user );
230235 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 @@ -307,6 +307,8 @@ riscv_t *rv_create(riscv_user_t rv_attr)
307307 elf_delete (elf );
308308
309309#if RV32_HAS (SYSTEM )
310+ /* this variable has external linkage to mmu_io defined in system.c */
311+ extern riscv_io_t mmu_io ;
310312 /* install the MMU I/O handlers */
311313 memcpy (& rv -> io , & mmu_io , sizeof (riscv_io_t ));
312314#else
@@ -333,7 +335,7 @@ riscv_t *rv_create(riscv_user_t rv_attr)
333335 memcpy (& rv -> io , & io , sizeof (riscv_io_t ));
334336#endif /* RV32_HAS(SYSTEM) */
335337 }
336- #if RV32_HAS (SYSTEM ) && !defined( USE_ELF )
338+ #if RV32_HAS (SYSTEM )
337339 else {
338340 /* *-----------------------------------------*
339341 * | Memory layout |
@@ -464,7 +466,7 @@ void rv_run(riscv_t *rv)
464466
465467 vm_attr_t * attr = PRIV (rv );
466468 assert (attr &&
467- #if RV32_HAS (SYSTEM )
469+ #if RV32_HAS (SYSTEM ) && ! defined ( USE_ELF )
468470 attr -> data .system && attr -> data .system -> kernel &&
469471 attr -> data .system -> initrd && attr -> data .system -> dtb
470472#else
You can’t perform that action at this time.
0 commit comments