| 1 | # |
| 2 | # x86_64 system tests |
| 3 | # |
| 4 | |
| 5 | X64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system |
| 6 | X64_SYSTEM_TESTS=$(patsubst $(X64_SYSTEM_SRC)/%.c, %, $(wildcard $(X64_SYSTEM_SRC)/*.c)) |
| 7 | |
| 8 | VPATH+=$(X64_SYSTEM_SRC) |
| 9 | |
| 10 | # These objects provide the basic boot code and helper functions for all tests |
| 11 | CRT_OBJS=boot.o |
| 12 | |
| 13 | CRT_PATH=$(X64_SYSTEM_SRC) |
| 14 | LINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld |
| 15 | LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 |
| 16 | CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) |
| 17 | LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc |
| 18 | |
| 19 | TESTS+=$(MULTIARCH_TESTS) $(X64_SYSTEM_TESTS) |
| 20 | EXTRA_RUNS+=$(MULTIARCH_RUNS) |
| 21 | |
| 22 | # building head blobs |
| 23 | .PRECIOUS: $(CRT_OBJS) |
| 24 | |
| 25 | %.o: $(CRT_PATH)/%.S |
| 26 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack -c $< -o $@ |
| 27 | |
| 28 | # Build and link the tests |
| 29 | %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) |
| 30 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) |
| 31 | |
| 32 | memory: CFLAGS+=-DCHECK_UNALIGNED=1 |
| 33 | |
| 34 | # Running |
| 35 | QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel |
| 36 | |
| 37 | ifeq ($(CONFIG_PLUGIN),y) |
| 38 | run-plugin-patch-target-with-libpatch.so: \ |
| 39 | PLUGIN_ARGS=$(COMMA)target=ffc0$(COMMA)patch=9090$(COMMA)use_hwaddr=true |
| 40 | run-plugin-patch-target-with-libpatch.so: \ |
| 41 | CHECK_PLUGIN_OUTPUT_COMMAND=$(X64_SYSTEM_SRC)/validate-patch.py $@.out |
| 42 | run-plugin-patch-target-with-libpatch.so: patch-target libpatch.so |
| 43 | EXTRA_RUNS_WITH_PLUGIN+=run-plugin-patch-target-with-libpatch.so |
| 44 | endif |