filename | test/sh4/undef.s |
changeset | 523:f33381d87c2a |
prev | 358:65043a8f5785 |
author | nkeynes |
date | Sun Jul 20 11:36:48 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Initial implementation for sort-dma channel |
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
42 bra test_undef_end
43 nop
44 ! The following don't actually raise an exception, so skip over for the
45 ! moment.
47 ! Gaps in the STC range (0x0nn2)
48 test_undef_2: ! 0x52
49 add #1, r12
50 expect_exc 0x00000180
51 test_undef_2_pc:
52 .word 0x0052
53 assert_exc_caught test_undef_str_k test_undef_2_pc
55 test_undef_3: ! 0x62
56 add #1, r12
57 expect_exc 0x00000180
58 test_undef_3_pc:
59 .word 0x0062
60 assert_exc_caught test_undef_str_k test_undef_3_pc
62 test_undef_4: ! 0x72
63 add #1, r12
64 expect_exc 0x00000180
65 test_undef_4_pc:
66 .word 0x0072
67 assert_exc_caught test_undef_str_k test_undef_4_pc
69 ! Test undefined FP instructions w/ and w/o FP disable
70 test_undef_fpu_1:
71 add #1, r12
72 expect_exc 0x00000180
73 test_undef_fpu_1_pc:
74 .word 0xF0CD
75 assert_exc_caught test_undef_str_k test_undef_fpu_1_pc
77 test_undef_end:
78 end_test test_undef_str_k
80 test_undef_str_k:
81 .long test_undef_str
82 test_undef_str:
83 .string "UNDEFINED-INSTRUCTION"
.