5 AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
6 AARCH64_SYSTEM_SRC=$(AARCH64_SRC)/system
8 VPATH+=$(AARCH64_SYSTEM_SRC)
10 # These objects provide the basic boot code and helper functions for all tests
13 AARCH64_TEST_C_SRCS=$(wildcard $(AARCH64_SYSTEM_SRC)/*.c)
14 AARCH64_TEST_S_SRCS=$(AARCH64_SYSTEM_SRC)/mte.S
16 AARCH64_C_TESTS = $(patsubst $(AARCH64_SYSTEM_SRC)/%.c, %, $(AARCH64_TEST_C_SRCS))
17 AARCH64_S_TESTS = $(patsubst $(AARCH64_SYSTEM_SRC)/%.S, %, $(AARCH64_TEST_S_SRCS))
19 AARCH64_TESTS = $(AARCH64_C_TESTS)
20 AARCH64_TESTS += $(AARCH64_S_TESTS)
22 CRT_PATH=$(AARCH64_SYSTEM_SRC)
23 LINK_SCRIPT=$(AARCH64_SYSTEM_SRC)/kernel.ld
24 LDFLAGS=-Wl,-T$(LINK_SCRIPT)
25 TESTS+=$(AARCH64_TESTS) $(MULTIARCH_TESTS)
26 EXTRA_RUNS+=$(MULTIARCH_RUNS)
27 CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
28 LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
30 config-cc.mak: Makefile
32 $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3); \
33 $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak
34 -include config-cc.mak
37 .PRECIOUS: $(CRT_OBJS)
40 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@
42 # Build and link the tests
43 %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
44 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
46 memory: CFLAGS+=-DCHECK_UNALIGNED=1
48 memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
49 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
51 memory-sve: CFLAGS+=-DCHECK_UNALIGNED=1 -march=armv8.1-a+sve -O3
56 QEMU_BASE_MACHINE=-M virt -cpu max -display none
57 QEMU_BASE_ARGS=-semihosting-config enable=on,target=native,chardev=output
58 QEMU_OPTS+=$(QEMU_BASE_MACHINE) $(QEMU_BASE_ARGS) -kernel
60 # console test is manual only
61 QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
62 run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
63 run-semiconsole: semiconsole
64 $(call skip-test, $<, "MANUAL ONLY")
65 $(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
66 run-plugin-semiconsole-with-%: semiconsole
67 $(call skip-test, $<, "MANUAL ONLY")
69 # vtimer test needs EL2
70 QEMU_EL2_MACHINE=-machine virt,virtualization=on,gic-version=2 -cpu cortex-a57 -smp 4
71 run-vtimer: QEMU_OPTS=$(QEMU_EL2_MACHINE) $(QEMU_BASE_ARGS) -kernel
73 # Simple Record/Replay Test
75 run-memory-record: memory-record memory
76 $(call run-test, $<, \
77 $(QEMU) -monitor none -display none \
78 -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
79 -icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \
83 run-memory-replay: memory-replay run-memory-record
84 $(call run-test, $<, \
85 $(QEMU) -monitor none -display none \
86 -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
87 -icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \
90 EXTRA_RUNS+=run-memory-replay
92 ifneq ($(CROSS_CC_HAS_ARMV8_3),)
93 pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
96 $(call skip-test, "BUILD of $@", "missing compiler support")
98 $(call skip-test, "RUN of pauth-3", "not built")
101 ifneq ($(CROSS_CC_HAS_ARMV8_MTE),)
102 QEMU_MTE_ENABLED_MACHINE=-M virt,mte=on -cpu max -display none
103 QEMU_OPTS_WITH_MTE_ON = $(QEMU_MTE_ENABLED_MACHINE) $(QEMU_BASE_ARGS) -kernel
104 mte: CFLAGS+=-march=armv8.5-a+memtag
105 mte: mte.S $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
106 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
108 run-mte: QEMU_OPTS=$(QEMU_OPTS_WITH_MTE_ON)
111 ifeq ($(GDB_SUPPORTS_MTE_IN_BAREMETAL),y)
112 run-gdbstub-mte: QEMU_OPTS=$(QEMU_OPTS_WITH_MTE_ON)
114 $(call run-test, $@, $(GDB_SCRIPT) \
115 --output run-gdbstub-mte.out \
117 --qemu $(QEMU) --qargs "-chardev null$(COMMA)id=output $(QEMU_OPTS)" \
118 --bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py -- --mode=system, \
121 EXTRA_RUNS += run-gdbstub-mte
122 else # !GDB_SUPPORTS_MTE_IN_BAREMETAL
124 $(call skip-test "RUN of gdbstub-mte", "GDB does not support MTE in baremetal!")
126 else # !CROSS_CC_HAS_ARMV8_MTE
128 $(call skip-test, "BUILD of $@", "missing compiler support")
130 $(call skip-test, "RUN of mte", "not build")