2019-04-26 19:21:00 +03:00
|
|
|
#
|
|
|
|
# Aarch64 system tests
|
|
|
|
#
|
|
|
|
|
2024-09-10 20:39:00 +03:00
|
|
|
AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
|
|
|
|
AARCH64_SYSTEM_SRC=$(AARCH64_SRC)/system
|
|
|
|
|
2019-04-26 19:21:00 +03:00
|
|
|
VPATH+=$(AARCH64_SYSTEM_SRC)
|
|
|
|
|
|
|
|
# These objects provide the basic boot code and helper functions for all tests
|
|
|
|
CRT_OBJS=boot.o
|
|
|
|
|
2024-09-10 20:39:00 +03:00
|
|
|
AARCH64_TEST_C_SRCS=$(wildcard $(AARCH64_SYSTEM_SRC)/*.c)
|
|
|
|
AARCH64_TEST_S_SRCS=$(AARCH64_SYSTEM_SRC)/mte.S
|
|
|
|
|
|
|
|
AARCH64_C_TESTS = $(patsubst $(AARCH64_SYSTEM_SRC)/%.c, %, $(AARCH64_TEST_C_SRCS))
|
|
|
|
AARCH64_S_TESTS = $(patsubst $(AARCH64_SYSTEM_SRC)/%.S, %, $(AARCH64_TEST_S_SRCS))
|
|
|
|
|
|
|
|
AARCH64_TESTS = $(AARCH64_C_TESTS)
|
|
|
|
AARCH64_TESTS += $(AARCH64_S_TESTS)
|
2019-04-26 19:21:00 +03:00
|
|
|
|
|
|
|
CRT_PATH=$(AARCH64_SYSTEM_SRC)
|
|
|
|
LINK_SCRIPT=$(AARCH64_SYSTEM_SRC)/kernel.ld
|
|
|
|
LDFLAGS=-Wl,-T$(LINK_SCRIPT)
|
|
|
|
TESTS+=$(AARCH64_TESTS) $(MULTIARCH_TESTS)
|
2021-01-09 01:42:41 +03:00
|
|
|
EXTRA_RUNS+=$(MULTIARCH_RUNS)
|
2019-04-26 19:21:00 +03:00
|
|
|
CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
|
|
|
|
LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
|
|
|
|
|
2022-09-29 14:42:04 +03:00
|
|
|
config-cc.mak: Makefile
|
|
|
|
$(quiet-@)( \
|
2024-09-10 20:39:00 +03:00
|
|
|
$(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3); \
|
|
|
|
$(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak
|
2022-09-29 14:42:04 +03:00
|
|
|
-include config-cc.mak
|
|
|
|
|
2019-04-26 19:21:00 +03:00
|
|
|
# building head blobs
|
|
|
|
.PRECIOUS: $(CRT_OBJS)
|
|
|
|
|
|
|
|
%.o: $(CRT_PATH)/%.S
|
2024-07-29 17:44:03 +03:00
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@
|
2019-04-26 19:21:00 +03:00
|
|
|
|
|
|
|
# Build and link the tests
|
|
|
|
%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
|
2019-08-07 17:35:21 +03:00
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
|
2019-04-26 19:21:00 +03:00
|
|
|
|
2019-04-29 18:55:59 +03:00
|
|
|
memory: CFLAGS+=-DCHECK_UNALIGNED=1
|
|
|
|
|
2023-01-24 21:01:17 +03:00
|
|
|
memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
|
|
|
|
|
2024-07-05 11:40:15 +03:00
|
|
|
memory-sve: CFLAGS+=-DCHECK_UNALIGNED=1 -march=armv8.1-a+sve -O3
|
2023-01-24 21:01:17 +03:00
|
|
|
|
|
|
|
TESTS+=memory-sve
|
|
|
|
|
2019-04-26 19:21:00 +03:00
|
|
|
# Running
|
2019-12-18 17:28:36 +03:00
|
|
|
QEMU_BASE_MACHINE=-M virt -cpu max -display none
|
2023-11-20 20:35:06 +03:00
|
|
|
QEMU_BASE_ARGS=-semihosting-config enable=on,target=native,chardev=output
|
|
|
|
QEMU_OPTS+=$(QEMU_BASE_MACHINE) $(QEMU_BASE_ARGS) -kernel
|
2019-12-18 17:28:36 +03:00
|
|
|
|
|
|
|
# console test is manual only
|
2023-11-20 18:08:25 +03:00
|
|
|
QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
|
|
|
|
run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
|
2019-12-18 17:28:36 +03:00
|
|
|
run-semiconsole: semiconsole
|
|
|
|
$(call skip-test, $<, "MANUAL ONLY")
|
2023-11-20 18:08:25 +03:00
|
|
|
$(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
|
2019-12-18 17:28:36 +03:00
|
|
|
run-plugin-semiconsole-with-%: semiconsole
|
|
|
|
$(call skip-test, $<, "MANUAL ONLY")
|
2019-09-18 16:31:42 +03:00
|
|
|
|
2023-11-20 20:35:06 +03:00
|
|
|
# vtimer test needs EL2
|
|
|
|
QEMU_EL2_MACHINE=-machine virt,virtualization=on,gic-version=2 -cpu cortex-a57 -smp 4
|
|
|
|
run-vtimer: QEMU_OPTS=$(QEMU_EL2_MACHINE) $(QEMU_BASE_ARGS) -kernel
|
|
|
|
|
2019-09-18 16:31:42 +03:00
|
|
|
# Simple Record/Replay Test
|
|
|
|
.PHONY: memory-record
|
|
|
|
run-memory-record: memory-record memory
|
|
|
|
$(call run-test, $<, \
|
|
|
|
$(QEMU) -monitor none -display none \
|
|
|
|
-chardev file$(COMMA)path=$<.out$(COMMA)id=output \
|
|
|
|
-icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \
|
2022-09-29 14:42:03 +03:00
|
|
|
$(QEMU_OPTS) memory)
|
2019-09-18 16:31:42 +03:00
|
|
|
|
|
|
|
.PHONY: memory-replay
|
|
|
|
run-memory-replay: memory-replay run-memory-record
|
|
|
|
$(call run-test, $<, \
|
|
|
|
$(QEMU) -monitor none -display none \
|
|
|
|
-chardev file$(COMMA)path=$<.out$(COMMA)id=output \
|
|
|
|
-icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \
|
2022-09-29 14:42:03 +03:00
|
|
|
$(QEMU_OPTS) memory)
|
2019-09-18 16:31:42 +03:00
|
|
|
|
2020-05-20 17:05:30 +03:00
|
|
|
EXTRA_RUNS+=run-memory-replay
|
2020-01-23 18:22:39 +03:00
|
|
|
|
2022-04-19 12:10:07 +03:00
|
|
|
ifneq ($(CROSS_CC_HAS_ARMV8_3),)
|
2024-07-05 11:40:14 +03:00
|
|
|
pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
|
2020-02-03 12:09:28 +03:00
|
|
|
else
|
|
|
|
pauth-3:
|
|
|
|
$(call skip-test, "BUILD of $@", "missing compiler support")
|
|
|
|
run-pauth-3:
|
|
|
|
$(call skip-test, "RUN of pauth-3", "not built")
|
|
|
|
endif
|
2024-09-10 20:39:00 +03:00
|
|
|
|
|
|
|
ifneq ($(CROSS_CC_HAS_ARMV8_MTE),)
|
|
|
|
QEMU_MTE_ENABLED_MACHINE=-M virt,mte=on -cpu max -display none
|
|
|
|
QEMU_OPTS_WITH_MTE_ON = $(QEMU_MTE_ENABLED_MACHINE) $(QEMU_BASE_ARGS) -kernel
|
|
|
|
mte: CFLAGS+=-march=armv8.5-a+memtag
|
|
|
|
mte: mte.S $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
|
|
|
|
|
|
|
|
run-mte: QEMU_OPTS=$(QEMU_OPTS_WITH_MTE_ON)
|
|
|
|
run-mte: mte
|
|
|
|
|
|
|
|
ifeq ($(GDB_SUPPORTS_MTE_IN_BAREMETAL),y)
|
|
|
|
run-gdbstub-mte: QEMU_OPTS=$(QEMU_OPTS_WITH_MTE_ON)
|
|
|
|
run-gdbstub-mte: mte
|
|
|
|
$(call run-test, $@, $(GDB_SCRIPT) \
|
|
|
|
--output run-gdbstub-mte.out \
|
|
|
|
--gdb $(GDB) \
|
|
|
|
--qemu $(QEMU) --qargs "-chardev null$(COMMA)id=output $(QEMU_OPTS)" \
|
|
|
|
--bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py -- --mode=system, \
|
|
|
|
gdbstub MTE support)
|
|
|
|
|
|
|
|
EXTRA_RUNS += run-gdbstub-mte
|
|
|
|
else # !GDB_SUPPORTS_MTE_IN_BAREMETAL
|
|
|
|
run-gdbstub-mte:
|
|
|
|
$(call skip-test "RUN of gdbstub-mte", "GDB does not support MTE in baremetal!")
|
|
|
|
endif
|
|
|
|
else # !CROSS_CC_HAS_ARMV8_MTE
|
|
|
|
mte:
|
|
|
|
$(call skip-test, "BUILD of $@", "missing compiler support")
|
|
|
|
run-mte:
|
|
|
|
$(call skip-test, "RUN of mte", "not build")
|
|
|
|
endif
|