minix/tests/arm: naive tests to cause data aborts
Some assembly code to cause unaligned access as well as segmentation faults to exercise the data abort path. Change-Id: Ie419114b76a8db849537a94fda781019cf14d50d
This commit is contained in:
parent
0dd719f1bd
commit
35b65c5af1
9
distrib/sets/lists/minix-tests/md.evbarm
Normal file
9
distrib/sets/lists/minix-tests/md.evbarm
Normal file
@ -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
|
@ -126,6 +126,8 @@ PROGS+= test63 mod
|
|||||||
OBJS.${o} += common.o
|
OBJS.${o} += common.o
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
|
.include "./arch/${MACHINE_ARCH}/Makefile.inc"
|
||||||
|
|
||||||
# LSC Make sure there is not leftover after a failed testrun
|
# LSC Make sure there is not leftover after a failed testrun
|
||||||
clean: .PHONY .MAKE
|
clean: .PHONY .MAKE
|
||||||
@rm -rf DIR*
|
@rm -rf DIR*
|
||||||
|
7
minix/tests/arch/earm/Makefile.inc
Normal file
7
minix/tests/arch/earm/Makefile.inc
Normal file
@ -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
|
16
minix/tests/arch/earm/test_arm_segfault.S
Normal file
16
minix/tests/arch/earm/test_arm_segfault.S
Normal file
@ -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"
|
26
minix/tests/arch/earm/test_arm_unaligned.S
Normal file
26
minix/tests/arch/earm/test_arm_unaligned.S
Normal file
@ -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"
|
0
minix/tests/arch/i386/Makefile.inc
Normal file
0
minix/tests/arch/i386/Makefile.inc
Normal file
Loading…
x
Reference in New Issue
Block a user