Search
lxdream.org :: lxdream :: r533:9764673fd4a5
lxdream 0.9.1
released Jun 29
Download Now
changeset533:9764673fd4a5
parent532:43653e748030
child534:b936e530fabb
authornkeynes
dateTue Nov 20 08:31:34 2007 +0000 (12 years ago)
Fix TRAPA (translator) and add test case
src/sh4/sh4x86.c
src/sh4/sh4x86.in
test/Makefile.in
test/sh4/testsh4.c
test/sh4/trapa.s
1.1 --- a/src/sh4/sh4x86.c Mon Nov 19 08:51:03 2007 +0000
1.2 +++ b/src/sh4/sh4x86.c Tue Nov 20 08:31:34 2007 +0000
1.3 @@ -2832,9 +2832,10 @@
1.4 if( sh4_x86.in_delay_slot ) {
1.5 SLOTILLEGAL();
1.6 } else {
1.7 + load_imm32( R_ECX, pc+2 );
1.8 + store_spreg( R_ECX, REG_OFFSET(pc) );
1.9 load_imm32( R_EAX, imm );
1.10 call_func1( sh4_raise_trap, R_EAX );
1.11 - ADD_imm8s_r32( 4, R_ESP );
1.12 sh4_x86.tstate = TSTATE_NONE;
1.13 exit_block_pcset(pc);
1.14 sh4_x86.branch_taken = TRUE;
2.1 --- a/src/sh4/sh4x86.in Mon Nov 19 08:51:03 2007 +0000
2.2 +++ b/src/sh4/sh4x86.in Tue Nov 20 08:31:34 2007 +0000
2.3 @@ -1795,9 +1795,10 @@
2.4 if( sh4_x86.in_delay_slot ) {
2.5 SLOTILLEGAL();
2.6 } else {
2.7 + load_imm32( R_ECX, pc+2 );
2.8 + store_spreg( R_ECX, REG_OFFSET(pc) );
2.9 load_imm32( R_EAX, imm );
2.10 call_func1( sh4_raise_trap, R_EAX );
2.11 - ADD_imm8s_r32( 4, R_ESP );
2.12 sh4_x86.tstate = TSTATE_NONE;
2.13 exit_block_pcset(pc);
2.14 sh4_x86.branch_taken = TRUE;
3.1 --- a/test/Makefile.in Mon Nov 19 08:51:03 2007 +0000
3.2 +++ b/test/Makefile.in Tue Nov 20 08:31:34 2007 +0000
3.3 @@ -77,7 +77,7 @@
3.4 sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \
3.5 sh4/mac.s \
3.6 sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so \
3.7 - sh4/tas.so sh4/xtrct.so \
3.8 + sh4/trapa.so sh4/tas.so sh4/xtrct.so \
3.9 sh4/excslot.so sh4/undef.so
3.10 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
3.11 $(SH4OBJCOPY) testsh4 testsh4.bin
4.1 --- a/test/sh4/testsh4.c Mon Nov 19 08:51:03 2007 +0000
4.2 +++ b/test/sh4/testsh4.c Tue Nov 20 08:31:34 2007 +0000
4.3 @@ -67,6 +67,7 @@
4.4 test_shld();
4.5 test_sub();
4.6 test_subc();
4.7 + test_trapa();
4.8 test_tas();
4.9 test_xtrct();
4.10 fprintf( stdout, "--> %d/%d instruction tests passed (%d%%)\n\n",
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/test/sh4/trapa.s Tue Nov 20 08:31:34 2007 +0000
5.3 @@ -0,0 +1,36 @@
5.4 +.section .text
5.5 +.include "sh4/inc.s"
5.6 +
5.7 +.global _test_trapa
5.8 +_test_trapa:
5.9 + start_test
5.10 +
5.11 +test_trapa_1:
5.12 + add #1, r12
5.13 + expect_exc 0x00000160
5.14 + trapa #42
5.15 +
5.16 +test_trapa_1_pc:
5.17 + assert_exc_caught test_trapa_str_k test_trapa_1_pc
5.18 +
5.19 + mov.l test_trapa_tra, r1
5.20 + mov.l @r1, r2
5.21 + mov #42, r0
5.22 + shll r0
5.23 + shll r0
5.24 + cmp/eq r0, r2
5.25 + bt test_trapa_end
5.26 + fail test_trapa_str_k
5.27 + bra test_trapa_end
5.28 + nop
5.29 +
5.30 +test_trapa_tra:
5.31 + .long 0xFF000020
5.32 +
5.33 +test_trapa_end:
5.34 + end_test test_trapa_str_k
5.35 +
5.36 +test_trapa_str_k:
5.37 + .long test_trapa_str
5.38 +test_trapa_str:
5.39 + .string "TRAPA"
.