Search
lxdream.org :: lxdream/src/sh4/sh4core.in :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4core.in
changeset 582:c89a69dc427d
prev576:4945fa2ed24f
next1065:bc1cc0c54917
author nkeynes
date Tue Jan 15 10:03:27 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Fix emu instruction translation
file annotate diff log raw
1.1 --- a/src/sh4/sh4core.in Mon Jan 14 09:08:58 2008 +0000
1.2 +++ b/src/sh4/sh4core.in Tue Jan 15 10:03:27 2008 +0000
1.3 @@ -18,6 +18,7 @@
1.4 */
1.5
1.6 #define MODULE sh4_module
1.7 +#include <assert.h>
1.8 #include <math.h>
1.9 #include "dream.h"
1.10 #include "dreamcast.h"
1.11 @@ -234,15 +235,20 @@
1.12 CHECKRALIGN16(pc);
1.13
1.14 /* Read instruction */
1.15 - uint32_t pageaddr = pc >> 12;
1.16 if( !IS_IN_ICACHE(pc) ) {
1.17 - mmu_update_icache(pc);
1.18 + if( !mmu_update_icache(pc) ) {
1.19 + // Fault - look for the fault handler
1.20 + if( !mmu_update_icache(sh4r.pc) ) {
1.21 + // double fault - halt
1.22 + ERROR( "Double fault - halting" );
1.23 + dreamcast_stop();
1.24 + return FALSE;
1.25 + }
1.26 + }
1.27 + pc = sh4r.pc;
1.28 }
1.29 - if( IS_IN_ICACHE(pc) ) {
1.30 - ir = *(uint16_t *)GET_ICACHE_PTR(pc);
1.31 - } else {
1.32 - ir = sh4_read_word(pc);
1.33 - }
1.34 + assert( IS_IN_ICACHE(pc) );
1.35 + ir = *(uint16_t *)GET_ICACHE_PTR(sh4r.pc);
1.36 %%
1.37 AND Rm, Rn {: sh4r.r[Rn] &= sh4r.r[Rm]; :}
1.38 AND #imm, R0 {: R0 &= imm; :}
.