Search
lxdream.org :: lxdream/test/sh4/undef.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/sh4/undef.s
changeset 233:f8333b94f503
next358:65043a8f5785
author nkeynes
date Wed Sep 27 10:21:34 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Add user mode/system mode switch
Add undefined instruction tests
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@233
    21
! Gaps in the STC range (0x0nn2)
nkeynes@233
    22
test_undef_2:	! 0x52
nkeynes@233
    23
	add #1, r12
nkeynes@233
    24
	expect_exc 0x00000180
nkeynes@233
    25
test_undef_2_pc:
nkeynes@233
    26
	.word 0x0052
nkeynes@233
    27
	assert_exc_caught test_undef_str_k test_undef_2_pc
nkeynes@233
    28
nkeynes@233
    29
test_undef_3:	! 0x62
nkeynes@233
    30
	add #1, r12
nkeynes@233
    31
	expect_exc 0x00000180
nkeynes@233
    32
test_undef_3_pc:
nkeynes@233
    33
	.word 0x0062
nkeynes@233
    34
	assert_exc_caught test_undef_str_k test_undef_3_pc
nkeynes@233
    35
nkeynes@233
    36
test_undef_4:	! 0x72
nkeynes@233
    37
	add #1, r12
nkeynes@233
    38
	expect_exc 0x00000180
nkeynes@233
    39
test_undef_4_pc:
nkeynes@233
    40
	.word 0x0072
nkeynes@233
    41
	assert_exc_caught test_undef_str_k test_undef_4_pc
nkeynes@233
    42
nkeynes@233
    43
! Test undefined FP instructions w/ and w/o FP disable
nkeynes@233
    44
test_undef_fpu_1:
nkeynes@233
    45
	add #1, r12
nkeynes@233
    46
	expect_exc 0x00000180
nkeynes@233
    47
test_undef_fpu_1_pc:
nkeynes@233
    48
	.word 0xF0CD
nkeynes@233
    49
	assert_exc_caught test_undef_str_k test_undef_fpu_1_pc
nkeynes@233
    50
	
nkeynes@233
    51
test_undef_end:
nkeynes@233
    52
	end_test test_undef_str_k
nkeynes@233
    53
nkeynes@233
    54
test_undef_str_k:
nkeynes@233
    55
	.long test_undef_str
nkeynes@233
    56
test_undef_str:
nkeynes@233
    57
	.string "UNDEFINED-INSTRUCTION"
.