]> Zhao Yanbai Git Server - minix.git/commitdiff
minix/tests/arm: naive tests to cause data aborts 18/3518/2
authorArne Welzel <arne.welzel@gmail.com>
Thu, 22 Mar 2018 14:47:36 +0000 (15:47 +0100)
committerLionel Sambuc <lionel.sambuc@gmail.com>
Sun, 25 Mar 2018 15:44:11 +0000 (17:44 +0200)
Some assembly code to cause unaligned access as well as
segmentation faults to exercise the data abort path.

Change-Id: Ie419114b76a8db849537a94fda781019cf14d50d

distrib/sets/lists/minix-tests/md.evbarm [new file with mode: 0644]
minix/tests/Makefile
minix/tests/arch/earm/Makefile.inc [new file with mode: 0644]
minix/tests/arch/earm/test_arm_segfault.S [new file with mode: 0644]
minix/tests/arch/earm/test_arm_unaligned.S [new file with mode: 0644]
minix/tests/arch/i386/Makefile.inc [new file with mode: 0644]

diff --git a/distrib/sets/lists/minix-tests/md.evbarm b/distrib/sets/lists/minix-tests/md.evbarm
new file mode 100644 (file)
index 0000000..455c823
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# Sorted using sort_set.pl in releasetools.
+# to add an entry simply add it at the end of the
+# file and run
+# ../../../../releasetools/sort_set.pl < mi > out
+# mv out mi
+#
+./usr/tests/minix-posix/test_arm_segfault               minix-tests
+./usr/tests/minix-posix/test_arm_unaligned              minix-tests
index c0bcc8557b220d701fefe5236c6fb5deff225ba7..4662fe8723934c4f3516f6d9673878e8d77f7c81 100644 (file)
@@ -126,6 +126,8 @@ PROGS+=             test63 mod
 OBJS.${o} += common.o
 .endfor
 
+.include "./arch/${MACHINE_ARCH}/Makefile.inc"
+
 # LSC Make sure there is not leftover after a failed testrun
 clean: .PHONY .MAKE
        @rm -rf DIR*
diff --git a/minix/tests/arch/earm/Makefile.inc b/minix/tests/arch/earm/Makefile.inc
new file mode 100644 (file)
index 0000000..18c590c
--- /dev/null
@@ -0,0 +1,7 @@
+PROGS+= test_arm_segfault
+PROGS+= test_arm_unaligned
+
+.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}
+
+test_arm_segfault.o : test_arm_segfault.S
+test_arm_unaligned.o : test_arm_unaligned.S
diff --git a/minix/tests/arch/earm/test_arm_segfault.S b/minix/tests/arch/earm/test_arm_segfault.S
new file mode 100644 (file)
index 0000000..db13dc5
--- /dev/null
@@ -0,0 +1,16 @@
+.text
+.global main
+main:
+       push {lr}
+       ldr r0, =0xDEADBEE0 /* Hopefully this is not mapped... */
+       ldr r1, [r0]
+       ldr r0, =0x01010100 /* In case we survived, try something else */
+       ldr r1, [r0]
+
+       ldr r0, =msg
+       bl puts
+
+       mov r0, #0  /* test should check for non-zero exit code / signal */
+       pop {pc}
+msg:
+       .ascii "ERROR - caused no segfault\n"
diff --git a/minix/tests/arch/earm/test_arm_unaligned.S b/minix/tests/arch/earm/test_arm_unaligned.S
new file mode 100644 (file)
index 0000000..1d4486e
--- /dev/null
@@ -0,0 +1,26 @@
+.text
+.global main
+main:
+       push {lr}
+       mov r0, sp
+
+       /* This should work */
+       ldr r0, [sp]
+
+       /* Unalign it */
+       add r0, #2
+
+       /* Try a non-word aligned word-load, this may work if SCTRL.A == 0 */
+       ldr r1, [r0]
+
+       /* Load non-word aligned dword, should die even with SCTRL.A == 0 */
+       ldrd r2, r3, [r0]
+
+
+       ldr r0, =msg
+       bl puts
+
+       mov r0, #0  /* test should check for non-zero exit code / signal */
+       pop {pc}
+msg:
+       .ascii "ERROR - caused no sigbus\n"
diff --git a/minix/tests/arch/i386/Makefile.inc b/minix/tests/arch/i386/Makefile.inc
new file mode 100644 (file)
index 0000000..e69de29