filename | test/sh4/undef.s |
changeset | 523:f33381d87c2a |
prev | 358:65043a8f5785 |
author | nkeynes |
date | Fri Dec 02 18:18:04 2011 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | SH4 shadow-mode tweaks - Fix exceptions generated by the translator to account for the excepting instruction(s) in the cycle counts. - Compare floating point regs bitwise rather than with FP comparisons (otherwise can fail due to nan != nan) - Dump the translated block when we abort with an inconsistency |
file | annotate | diff | log | raw |
nkeynes@233 | 1 | .section .text |
nkeynes@233 | 2 | .include "sh4/inc.s" |
nkeynes@233 | 3 | ! |
nkeynes@233 | 4 | ! Test for undefined/unknown instructions. The only "official" |
nkeynes@233 | 5 | ! undefined instruction is 0xFFFD, but this tests everything |
nkeynes@233 | 6 | ! that doesn't match a known instruction pattern. Undefined |
nkeynes@233 | 7 | ! instructions are expected to raise general-illegal when not |
nkeynes@233 | 8 | ! in a delay slot, and slot-illegal when in a delay slot. |
nkeynes@233 | 9 | |
nkeynes@233 | 10 | .global _test_undefined |
nkeynes@233 | 11 | _test_undefined: |
nkeynes@233 | 12 | start_test |
nkeynes@233 | 13 | |
nkeynes@233 | 14 | test_undef_1: ! First the official one |
nkeynes@233 | 15 | add #1, r12 |
nkeynes@233 | 16 | expect_exc 0x00000180 |
nkeynes@233 | 17 | test_undef_1_pc: |
nkeynes@233 | 18 | .word 0xFFFD |
nkeynes@233 | 19 | assert_exc_caught test_undef_str_k test_undef_1_pc |
nkeynes@233 | 20 | |
nkeynes@358 | 21 | test_undef_1a: ! 0xFFFD with FPU disabled - should still be an 0x180 |
nkeynes@358 | 22 | add #1, r12 |
nkeynes@358 | 23 | stc sr, r0 |
nkeynes@358 | 24 | xor r1, r1 |
nkeynes@358 | 25 | add #32, r1 |
nkeynes@358 | 26 | shll2 r1 |
nkeynes@358 | 27 | shll8 r1 |
nkeynes@358 | 28 | or r0, r1 |
nkeynes@358 | 29 | ldc r1, sr |
nkeynes@358 | 30 | expect_exc 0x00000180 |
nkeynes@358 | 31 | test_undef_1a_pc: |
nkeynes@358 | 32 | .word 0xFFFD |
nkeynes@358 | 33 | assert_exc_caught test_undef_str_k test_undef_1a_pc |
nkeynes@358 | 34 | stc sr, r0 |
nkeynes@358 | 35 | xor r1, r1 |
nkeynes@358 | 36 | add #32, r1 |
nkeynes@358 | 37 | shll2 r1 |
nkeynes@358 | 38 | shll8 r1 |
nkeynes@358 | 39 | not r1, r1 |
nkeynes@358 | 40 | and r0, r1 |
nkeynes@358 | 41 | ldc r1, sr |
nkeynes@523 | 42 | bra test_undef_end |
nkeynes@523 | 43 | nop |
nkeynes@523 | 44 | ! The following don't actually raise an exception, so skip over for the |
nkeynes@523 | 45 | ! moment. |
nkeynes@523 | 46 | |
nkeynes@233 | 47 | ! Gaps in the STC range (0x0nn2) |
nkeynes@233 | 48 | test_undef_2: ! 0x52 |
nkeynes@233 | 49 | add #1, r12 |
nkeynes@233 | 50 | expect_exc 0x00000180 |
nkeynes@233 | 51 | test_undef_2_pc: |
nkeynes@233 | 52 | .word 0x0052 |
nkeynes@233 | 53 | assert_exc_caught test_undef_str_k test_undef_2_pc |
nkeynes@233 | 54 | |
nkeynes@233 | 55 | test_undef_3: ! 0x62 |
nkeynes@233 | 56 | add #1, r12 |
nkeynes@233 | 57 | expect_exc 0x00000180 |
nkeynes@233 | 58 | test_undef_3_pc: |
nkeynes@233 | 59 | .word 0x0062 |
nkeynes@233 | 60 | assert_exc_caught test_undef_str_k test_undef_3_pc |
nkeynes@233 | 61 | |
nkeynes@233 | 62 | test_undef_4: ! 0x72 |
nkeynes@233 | 63 | add #1, r12 |
nkeynes@233 | 64 | expect_exc 0x00000180 |
nkeynes@233 | 65 | test_undef_4_pc: |
nkeynes@233 | 66 | .word 0x0072 |
nkeynes@233 | 67 | assert_exc_caught test_undef_str_k test_undef_4_pc |
nkeynes@233 | 68 | |
nkeynes@233 | 69 | ! Test undefined FP instructions w/ and w/o FP disable |
nkeynes@233 | 70 | test_undef_fpu_1: |
nkeynes@233 | 71 | add #1, r12 |
nkeynes@233 | 72 | expect_exc 0x00000180 |
nkeynes@233 | 73 | test_undef_fpu_1_pc: |
nkeynes@233 | 74 | .word 0xF0CD |
nkeynes@233 | 75 | assert_exc_caught test_undef_str_k test_undef_fpu_1_pc |
nkeynes@233 | 76 | |
nkeynes@233 | 77 | test_undef_end: |
nkeynes@233 | 78 | end_test test_undef_str_k |
nkeynes@233 | 79 | |
nkeynes@233 | 80 | test_undef_str_k: |
nkeynes@233 | 81 | .long test_undef_str |
nkeynes@233 | 82 | test_undef_str: |
nkeynes@233 | 83 | .string "UNDEFINED-INSTRUCTION" |
.