| 1 | # |
| 2 | # RISC-V system tests |
| 3 | # |
| 4 | |
| 5 | TEST_SRC = $(SRC_PATH)/tests/tcg/riscv64 |
| 6 | VPATH += $(TEST_SRC) |
| 7 | |
| 8 | LINK_SCRIPT = $(TEST_SRC)/semihost.ld |
| 9 | LDFLAGS = -T $(LINK_SCRIPT) |
| 10 | CFLAGS += -g -Og |
| 11 | |
| 12 | %.o: %.S |
| 13 | $(CC) $(CFLAGS) $< -Wa,--noexecstack -c -o $@ |
| 14 | %: %.o $(LINK_SCRIPT) |
| 15 | $(LD) $(LDFLAGS) $< -o $@ |
| 16 | |
| 17 | QEMU_OPTS += -M virt -display none -semihosting -device loader,file= |
| 18 | |
| 19 | EXTRA_RUNS += run-issue1060 |
| 20 | run-issue1060: issue1060 |
| 21 | $(call run-test, $<, $(QEMU) $(QEMU_OPTS)$<) |
| 22 | |
| 23 | EXTRA_RUNS += run-test-mepc-masking |
| 24 | run-test-mepc-masking: test-mepc-masking |
| 25 | $(call run-test, $<, $(QEMU) $(QEMU_OPTS)$<) |
| 26 | |
| 27 | EXTRA_RUNS += run-test-minstret-ecall |
| 28 | run-test-minstret-ecall: test-minstret-ecall |
| 29 | $(call run-test, $<, $(QEMU) -icount shift=1 $(QEMU_OPTS)$<) |
| 30 | |
| 31 | EXTRA_RUNS += run-plugin-doubletrap |
| 32 | run-plugin-doubletrap: doubletrap |
| 33 | $(call run-test, $<, \ |
| 34 | $(QEMU) -plugin ../plugins/libdiscons.so -d plugin -D $<.pout \ |
| 35 | $(QEMU_OPTS)$<) |
| 36 | |
| 37 | EXTRA_RUNS += run-plugin-interruptedmemory |
| 38 | run-plugin-interruptedmemory: interruptedmemory |
| 39 | $(call run-test, $<, \ |
| 40 | $(QEMU) -plugin ../plugins/libdiscons.so -d plugin -D $<.pout \ |
| 41 | $(QEMU_OPTS)$<) |
| 42 | |
| 43 | EXTRA_RUNS += run-test-crc32 |
| 44 | comma:= , |
| 45 | run-test-crc32: test-crc32 |
| 46 | $(call run-test, $<, $(QEMU) -cpu rv64$(comma)xlrbr=true $(QEMU_OPTS)$<) |
| 47 | |
| 48 | # Zicclsm: misaligned load/store support. Assemble one source twice: the |
| 49 | # default build expects every misaligned access to succeed (zicclsm=true), |
| 50 | # the -DZICCLSM_DISABLED build expects every one to trap (zicclsm=false). |
| 51 | ZICCLSM_MARCH = -march=rv64gcv_zfh |
| 52 | CLEANFILES += test-zicclsm test-zicclsm-off |
| 53 | |
| 54 | test-zicclsm: test-zicclsm.S $(LINK_SCRIPT) |
| 55 | $(CC) $(CFLAGS) $(ZICCLSM_MARCH) $< -Wa,--noexecstack -c -o test-zicclsm.o |
| 56 | $(LD) $(LDFLAGS) test-zicclsm.o -o $@ |
| 57 | |
| 58 | test-zicclsm-off: test-zicclsm.S $(LINK_SCRIPT) |
| 59 | $(CC) $(CFLAGS) $(ZICCLSM_MARCH) -DZICCLSM_DISABLED $< -Wa,--noexecstack -c -o test-zicclsm-off.o |
| 60 | $(LD) $(LDFLAGS) test-zicclsm-off.o -o $@ |
| 61 | |
| 62 | EXTRA_RUNS += run-test-zicclsm |
| 63 | run-test-zicclsm: test-zicclsm |
| 64 | $(call run-test, $<, $(QEMU) -cpu rv64$(comma)v=true$(comma)zfh=true$(comma)zicclsm=true $(QEMU_OPTS)$<) |
| 65 | |
| 66 | EXTRA_RUNS += run-test-zicclsm-off |
| 67 | run-test-zicclsm-off: test-zicclsm-off |
| 68 | $(call run-test, $<, $(QEMU) -cpu rv64$(comma)v=true$(comma)zfh=true$(comma)zicclsm=false $(QEMU_OPTS)$<) |
| 69 | |
| 70 | EXTRA_RUNS += run-test-misa-w |
| 71 | run-test-misa-w: test-misa-w |
| 72 | $(call run-test, $<, $(QEMU) -cpu rv64$(comma)x-misa-w=true$(comma)c=true$(comma)v=true $(QEMU_OPTS)$<) |
| 73 | |
| 74 | # We don't currently support the multiarch system tests |
| 75 | undefine MULTIARCH_TESTS |