# HG changeset patch # User nkeynes # Date 1219493281 0 # Node ID 6e05367584658a1d78e6a800190f06c1c4584a99 # Parent 4398dafeb77d8c4311b68e52300086af67c0bc56 Mask off SR correctly when writing to it - this turns out to be important in some cases --- a/src/sh4/sh4.c Wed Aug 20 11:25:46 2008 +0000 +++ b/src/sh4/sh4.c Sat Aug 23 12:08:01 2008 +0000 @@ -326,7 +326,7 @@ int newbank = (newval&SR_MDRB) == SR_MDRB; if( oldbank != newbank ) sh4_switch_banks(); - sh4r.sr = newval; + sh4r.sr = newval & SR_MASK; sh4r.t = (newval&SR_T) ? 1 : 0; sh4r.s = (newval&SR_S) ? 1 : 0; sh4r.m = (newval&SR_M) ? 1 : 0; --- a/test/Makefile.in Wed Aug 20 11:25:46 2008 +0000 +++ b/test/Makefile.in Sat Aug 23 12:08:01 2008 +0000 @@ -81,7 +81,7 @@ sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \ sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \ sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \ - sh4/mac.so \ + sh4/ldcsr.so sh4/mac.so \ sh4/rot.so sh4/shl.so sh4/shld.so sh4/sub.so sh4/subc.so \ sh4/trapa.so sh4/tas.so sh4/xtrct.so \ sh4/excslot.so sh4/undef.so sh4/tlb.so sh4/vmexit.so @@ -165,7 +165,7 @@ lib.c lib.h math.s pvr.c pvr.h rendload.c sh4/add.s sh4/addc.s \ sh4/addv.s sh4/and.s sh4/andi.s sh4/bf.s sh4/bsr.s sh4/bt.s sh4/cmp.s \ sh4/cmpstr.s sh4/div0.s sh4/div1.s sh4/excslot.s sh4/float.s sh4/fmov.s \ - sh4/ftrc.s sh4/inc.s sh4/mac.s sh4/rot.s sh4/shl.s sh4/shld.s sh4/sub.s \ + sh4/ftrc.s sh4/inc.s sh4/mac.s sh4/ldcsr.s sh4/rot.s sh4/shl.s sh4/shld.s sh4/sub.s \ sh4/subc.s sh4/tas.s sh4/testsh4.c sh4/tlb.s sh4/vmexit.s sh4/trapa.s sh4/undef.s \ sh4/xtrct.s testdata.c testdata.h testdisp.c testide.c testmath.c \ testmmu.c testregs.c testrend.c testspu.c testta.c testyuv.c timer.c timer.h \ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sh4/ldcsr.s Sat Aug 23 12:08:01 2008 +0000 @@ -0,0 +1,31 @@ +.section .text +.include "sh4/inc.s" + +.global _test_ldcsr +_test_ldcsr: + start_test + +test_ldcsr_1: + add #1, r12 + + stc sr, r0 + mov #-1, r1 + ldc r1, sr + stc sr, r2 + ldc r0, sr + mov.l sr_mask, r3 + cmp/eq r2, r3 + bt test_ldcsr_end + fail test_ldcsr_str_k + +test_ldcsr_end: + end_test test_ldcsr_str_k + +test_ldcsr_str: + .string "LDC Rn, SR" +.align 4 +sr_mask: + .long 0x700083F3 +test_ldcsr_str_k: + .long test_ldcsr_str + \ No newline at end of file --- a/test/sh4/testsh4.c Wed Aug 20 11:25:46 2008 +0000 +++ b/test/sh4/testsh4.c Sat Aug 23 12:08:01 2008 +0000 @@ -85,6 +85,7 @@ test_float(); test_fmov(); test_ftrc(); + test_ldcsr(); test_mac(); test_rot(); test_shl();