1fc76c56dSPaolo Bonzini#
2fc76c56dSPaolo Bonzini# x86 system tests
3fc76c56dSPaolo Bonzini#
4fc76c56dSPaolo Bonzini# This currently builds only for i386. The common C code is built
5fc76c56dSPaolo Bonzini# with standard compiler flags however so we can support both by
6fc76c56dSPaolo Bonzini# adding additional boot files for x86_64.
7fc76c56dSPaolo Bonzini#
8fc76c56dSPaolo Bonzini
9fc76c56dSPaolo BonziniI386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system
10fc76c56dSPaolo BonziniX64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system
11fc76c56dSPaolo Bonzini
12fc76c56dSPaolo Bonzini# These objects provide the basic boot code and helper functions for all tests
13fc76c56dSPaolo BonziniCRT_OBJS=boot.o
14fc76c56dSPaolo Bonzini
15fc76c56dSPaolo BonziniCRT_PATH=$(X64_SYSTEM_SRC)
16fc76c56dSPaolo BonziniLINK_SCRIPT=$(X64_SYSTEM_SRC)/kernel.ld
17fc76c56dSPaolo BonziniLDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64
18fc76c56dSPaolo BonziniCFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
19fc76c56dSPaolo BonziniLDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
20fc76c56dSPaolo Bonzini
21fc76c56dSPaolo BonziniTESTS+=$(MULTIARCH_TESTS)
22c00506aaSAlex BennéeEXTRA_RUNS+=$(MULTIARCH_RUNS)
23fc76c56dSPaolo Bonzini
24fc76c56dSPaolo Bonzini# building head blobs
25fc76c56dSPaolo Bonzini.PRECIOUS: $(CRT_OBJS)
26fc76c56dSPaolo Bonzini
27fc76c56dSPaolo Bonzini%.o: $(CRT_PATH)/%.S
28*6c180490SRichard Henderson	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -Wa,--noexecstack -c $< -o $@
29fc76c56dSPaolo Bonzini
30fc76c56dSPaolo Bonzini# Build and link the tests
31fc76c56dSPaolo Bonzini%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
32fc76c56dSPaolo Bonzini	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
33fc76c56dSPaolo Bonzini
34fc76c56dSPaolo Bonzinimemory: CFLAGS+=-DCHECK_UNALIGNED=1
35fc76c56dSPaolo Bonzini
36fc76c56dSPaolo Bonzini# Running
37fc76c56dSPaolo BonziniQEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
38