2019-03-01 17:37:02 +01:00
|
|
|
#
|
|
|
|
# x86 system tests
|
|
|
|
#
|
|
|
|
# This currently builds only for i386. The common C code is built
|
|
|
|
# with standard compiler flags however so we can support both by
|
|
|
|
# adding additional boot files for x86_64.
|
|
|
|
#
|
|
|
|
|
|
|
|
I386_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/i386/system
|
|
|
|
X64_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/x86_64/system
|
|
|
|
|
|
|
|
# These objects provide the basic boot code and helper functions for all tests
|
|
|
|
CRT_OBJS=boot.o
|
|
|
|
|
|
|
|
CRT_PATH=$(I386_SYSTEM_SRC)
|
|
|
|
LINK_SCRIPT=$(I386_SYSTEM_SRC)/kernel.ld
|
|
|
|
LDFLAGS=-Wl,-T$(LINK_SCRIPT) -Wl,-melf_i386
|
|
|
|
CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
|
|
|
|
LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
|
|
|
|
|
2019-06-04 17:30:05 +02:00
|
|
|
TESTS+=$(MULTIARCH_TESTS)
|
2021-01-08 23:42:41 +01:00
|
|
|
EXTRA_RUNS+=$(MULTIARCH_RUNS)
|
2019-06-04 17:30:05 +02:00
|
|
|
|
2019-03-01 17:37:02 +01:00
|
|
|
# building head blobs
|
|
|
|
.PRECIOUS: $(CRT_OBJS)
|
|
|
|
|
|
|
|
%.o: $(CRT_PATH)/%.S
|
2019-08-07 16:35:21 +02:00
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
|
2019-03-01 17:37:02 +01:00
|
|
|
|
|
|
|
# Build and link the tests
|
|
|
|
%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
|
2019-08-07 16:35:21 +02:00
|
|
|
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
|
2019-03-01 17:37:02 +01:00
|
|
|
|
2019-04-29 17:55:59 +02:00
|
|
|
memory: CFLAGS+=-DCHECK_UNALIGNED=1
|
|
|
|
|
2021-02-13 14:03:16 +01:00
|
|
|
# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so
|
|
|
|
run-plugin-%-with-libinsn.so:
|
|
|
|
$(call run-test, $@, \
|
|
|
|
$(QEMU) -monitor none -display none \
|
|
|
|
-chardev file$(COMMA)path=$@.out$(COMMA)id=output \
|
2021-07-30 15:58:14 +02:00
|
|
|
-plugin ../../plugin/libinsn.so$(COMMA)inline=on \
|
2021-02-13 14:03:16 +01:00
|
|
|
-d plugin -D $*-with-libinsn.so.pout \
|
|
|
|
$(QEMU_OPTS) $*, \
|
|
|
|
"$* on $(TARGET_NAME)")
|
|
|
|
|
2019-03-01 17:37:02 +01:00
|
|
|
# Running
|
|
|
|
QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
|