Skip to content

Commit

Permalink
Merge pull request #485 from sysprog21/memory-for-arch-tests
Browse files Browse the repository at this point in the history
Allocate adequate memory for running arch-test
  • Loading branch information
jserv authored Sep 2, 2024
2 parents feca1de + 37b1383 commit 3c60966
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .ci/riscv-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ set -x

export PATH=`pwd`/toolchain/bin:$PATH

make clean
make distclean
# Rebuild with all RISC-V extensions
# FIXME: To pass the RISC-V Architecture Tests, full access to 4 GiB is
# necessary. We need to investigate why full 4 GiB memory access is required
# for this purpose, although the emulator can run all selected benchmarks with
# much smaller memory mapping regions.
make ENABLE_EXT_M=1 ENABLE_EXT_A=1 ENABLE_EXT_F=1 ENABLE_EXT_C=1 \
ENABLE_Zicsr=1 ENABLE_Zifencei=1 ENABLE_FULL4G=1
make arch-test RISCV_DEVICE=IMAFCZicsrZifencei || exit 1
make arch-test RISCV_DEVICE=FCZicsr || exit 1
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ $(call set-feature, Zicsr)
ENABLE_Zifencei ?= 1
$(call set-feature, Zifencei)

ENABLE_FULL4G ?= 0

# Experimental SDL oriented system calls
ENABLE_SDL ?= 1
ifneq ("$(CC_IS_EMCC)", "1") # note that emcc generates port SDL headers/library, so it does not requires system SDL headers/library
Expand All @@ -99,12 +101,19 @@ ifeq ($(call has, SDL), 1)
OBJS_EXT += syscall_sdl.o
$(OUT)/syscall_sdl.o: CFLAGS += $(shell sdl2-config --cflags)
# 4 GiB of memory is required to run video games.
$(OUT)/main.o: CFLAGS += -DMEM_SIZE=0xFFFFFFFFULL # 2^{32} - 1
ENABLE_FULL4G := 1
LDFLAGS += $(shell sdl2-config --libs) -pthread
LDFLAGS += $(shell pkg-config --libs SDL2_mixer)
endif
endif

# Full access to a 4 GiB address space, necessitating more memory mapping
# during emulator initialization.
$(call set-feature, FULL4G)
ifeq ($(call has, FULL4G), 1)
$(OUT)/main.o: CFLAGS += -DMEM_SIZE=0xFFFFFFFFULL # 2^{32} - 1
endif

ENABLE_GDBSTUB ?= 0
$(call set-feature, GDBSTUB)
ifeq ($(call has, GDBSTUB), 1)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ The image containing all the necessary tools for development and testing can be
* `ENABLE_Zicsr`: Control and Status Register (CSR)
* `ENABLE_Zifencei`: Instruction-Fetch Fence
* `ENABLE_GDBSTUB` : GDB remote debugging support
* `ENABLE_FULL4G` : Full access to 4 GiB address space
* `ENABLE_SDL` : Experimental Display and Event System Calls
* `ENABLE_JIT` : Experimental JIT compiler

Expand Down
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ static void dump_test_signature(const char *prog_name)
#endif
/* FIXME: MEM_SIZE shall be defined on different runtime */
#ifndef MEM_SIZE
/* Allocate 2^{19} - 1 bytes, which is ample for all known benchmarks. */
#define MEM_SIZE 0x80000
/* Allocate 2^{19} bytes, which is ample for all selective benchmarks. */
#define MEM_SIZE 0x80000ULL
#endif
#define STACK_SIZE 0x1000 /* 4096 */
#define ARGS_OFFSET_SIZE 0x1000 /* 4096 */
Expand Down

0 comments on commit 3c60966

Please sign in to comment.