Search
lxdream.org :: lxdream/test/sh4/undef.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/undef.s
changeset 358:65043a8f5785
prev233:f8333b94f503
next523:f33381d87c2a
author nkeynes
date Thu Aug 23 12:31:31 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Add tests for mac.l and mac.w
Start test cases for fmov
Update exception tests
view annotate diff log raw
     1 .section .text
     2 .include "sh4/inc.s"
     3 !
     4 ! Test for undefined/unknown instructions. The only "official"
     5 ! undefined instruction is 0xFFFD, but this tests everything
     6 ! that doesn't match a known instruction pattern. Undefined
     7 ! instructions are expected to raise general-illegal when not
     8 ! in a delay slot, and slot-illegal when in a delay slot.
    10 .global _test_undefined
    11 _test_undefined:	
    12 	start_test
    14 test_undef_1:	! First the official one
    15 	add #1, r12
    16 	expect_exc 0x00000180
    17 test_undef_1_pc:
    18 	.word 0xFFFD
    19 	assert_exc_caught test_undef_str_k test_undef_1_pc
    21 test_undef_1a:	! 0xFFFD with FPU disabled - should still be an 0x180
    22 	add #1, r12
    23 	stc sr, r0
    24 	xor r1, r1
    25 	add #32, r1
    26 	shll2 r1
    27 	shll8 r1
    28 	or r0, r1
    29 	ldc r1, sr
    30 	expect_exc 0x00000180
    31 test_undef_1a_pc:
    32 	.word 0xFFFD
    33 	assert_exc_caught test_undef_str_k test_undef_1a_pc
    34 	stc sr, r0
    35 	xor r1, r1
    36 	add #32, r1
    37 	shll2 r1
    38 	shll8 r1
    39 	not r1, r1
    40 	and r0, r1
    41 	ldc r1, sr
    43 ! Gaps in the STC range (0x0nn2)
    44 test_undef_2:	! 0x52
    45 	add #1, r12
    46 	expect_exc 0x00000180
    47 test_undef_2_pc:
    48 	.word 0x0052
    49 	assert_exc_caught test_undef_str_k test_undef_2_pc
    51 test_undef_3:	! 0x62
    52 	add #1, r12
    53 	expect_exc 0x00000180
    54 test_undef_3_pc:
    55 	.word 0x0062
    56 	assert_exc_caught test_undef_str_k test_undef_3_pc
    58 test_undef_4:	! 0x72
    59 	add #1, r12
    60 	expect_exc 0x00000180
    61 test_undef_4_pc:
    62 	.word 0x0072
    63 	assert_exc_caught test_undef_str_k test_undef_4_pc
    65 ! Test undefined FP instructions w/ and w/o FP disable
    66 test_undef_fpu_1:
    67 	add #1, r12
    68 	expect_exc 0x00000180
    69 test_undef_fpu_1_pc:
    70 	.word 0xF0CD
    71 	assert_exc_caught test_undef_str_k test_undef_fpu_1_pc
    73 test_undef_end:
    74 	end_test test_undef_str_k
    76 test_undef_str_k:
    77 	.long test_undef_str
    78 test_undef_str:
    79 	.string "UNDEFINED-INSTRUCTION"
.