Skip to contentSkip to conversation

target/arm: add ARMv6-M UNDEFINED 32-bit instruction test

RFC Superseded Stefan Hajnoczi 1 participant 1 message Jun 10, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 target/arm: add ARMv6-M UNDEFINED 32-bit instruction test

Test that 32-bit instructions declared UNDEFINED in the ARMv6-M Reference Manual really do raise an exception.

The Intel HEX (.hex) file is included to save people the trouble of installing a cross-compiler toolchain.

To run the test (make sure qemu-system-arm is in your $PATH):

  $ cd tests/tcg/arm
  $ make run-test-armv6m-undef

Based-on: http://github.com/stefanha/qemu/commits/microbit
---
Hi Julia,
Several instructions are currently not raising an exception. I have commented them out with "FAIL". Maybe your 32-bit instruction work will fix them. Otherwise they require additional investigation.

Hi Peter and Alex,
Is this along the lines you were thinking of when we discussed this type of test on IRC?

 tests/tcg/arm/Makefile              |  21 +++++
 tests/tcg/arm/test-armv6m-undef.S   | 119 ++++++++++++++++++++++++++++
 tests/tcg/arm/test-armv6m-undef.hex |  17 ++++
 tests/tcg/arm/test-armv6m-undef.ld  |  21 +++++
 4 files changed, 178 insertions(+)
 create mode 100644 tests/tcg/arm/Makefile
 create mode 100644 tests/tcg/arm/test-armv6m-undef.S
 create mode 100644 tests/tcg/arm/test-armv6m-undef.hex
 create mode 100644 tests/tcg/arm/test-armv6m-undef.ld
tests/tcg/arm/Makefile new file +21 -0
new file mode 100644
index 0000000000..c43049ca10
@@ -0,0 +1,21 @@
+CC = arm-linux-gnu-gcc
+OBJCOPY = arm-linux-gnu-objcopy
+
+SOURCES = $(wildcard *.S)
+BINARIES = $(patsubst %.S,%.hex,$(SOURCES))
+
+.PHONY: clean
+
+all: $(BINARIES)
+
+clean:
+	rm -f $(BINARIES) *.o
+
+%.o: %.S %.ld
+	$(CC) -nostdlib -Wl,--build-id=none -x assembler-with-cpp -T $(patsubst %.S,%.ld,$<) -x assembler-with-cpp -o $@ $<
+
+%.hex: %.o
+	$(OBJCOPY) -O ihex $< $@
+
+run-test-armv6m-undef: test-armv6m-undef.hex
+	qemu-system-arm -semihosting -M microbit -kernel $<
tests/tcg/arm/test-armv6m-undef.S new file +119 -0

119 lines not on this page · raw message

tests/tcg/arm/test-armv6m-undef.hex new file +17 -0
new file mode 100644
index 0000000000..7abd63a386
@@ -0,0 +1,17 @@
+:1000000000400020C100000000000000D5000000FA
+:1000100000000000000000000000000000000000E0
+:1000200000000000000000000000000000000000D0
+:1000300000000000000000000000000000000000C0
+:1000400000000000000000000000000000000000B0
+:1000500000000000000000000000000000000000A0
+:100060000000000000000000000000000000000090
+:100070000000000000000000000000000000000080
+:100080000000000000000000000000000000000070
+:100090000000000000000000000000000000000060
+:1000A0000000000000000000000000000000000050
+:1000B0000000000000000000000000000000000040
+:1000C00000F0000004E0F0F700A001E0012005E0EE
+:1000D000002003E0069806300690704700210128B2
+:0C00E00000D101491820ABBE2600020030
+:04000003000000C138
+:00000001FF
tests/tcg/arm/test-armv6m-undef.ld new file +21 -0
new file mode 100644
index 0000000000..43dbbf17d5
@@ -0,0 +1,21 @@
+ENTRY(exc_reset_thumb)
+
+SECTIONS
+{
+    . = 0x0;
+    .text : {
+        *(.text)
+    }
+    .data : {
+        *(.data)
+    }
+    .rodata : {
+        *(.rodata)
+    }
+    .bss : {
+        *(.bss)
+    }
+    /DISCARD/ : {
+        *(.ARM.attributes)
+    }
+}
Signature · 1 line
2.17.1