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