Search
lxdream.org :: lxdream/src/sh4/sh4mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4mem.c
changeset 406:9289b62f8f33
prev400:049d72a7a229
next418:b9b14afa0959
author nkeynes
date Mon Oct 01 11:51:25 2007 +0000 (16 years ago)
permissions -rw-r--r--
last change Fix fr_bank on save file load
file annotate diff log raw
1.1 --- a/src/sh4/sh4mem.c Thu Sep 20 08:35:04 2007 +0000
1.2 +++ b/src/sh4/sh4mem.c Mon Oct 01 11:51:25 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4mem.c,v 1.23 2007-09-20 08:35:04 nkeynes Exp $
1.6 + * $Id: sh4mem.c,v 1.24 2007-09-28 07:25:22 nkeynes Exp $
1.7 * sh4mem.c is responsible for the SH4's access to memory (including memory
1.8 * mapped I/O), using the page maps created in mem.c
1.9 *
1.10 @@ -49,6 +49,7 @@
1.11 #define CHECK_WRITE_WATCH( addr, size, val )
1.12 #endif
1.13
1.14 +#ifdef ENABLE_TRACE_IO
1.15 #define TRACE_IO( str, p, r, ... ) if(io_rgn[(uint32_t)p]->trace_flag && !MMIO_NOTRACE_BYNUM((uint32_t)p,r)) \
1.16 TRACE( str " [%s.%s: %s]", __VA_ARGS__, \
1.17 MMIO_NAME_BYNUM((uint32_t)p), MMIO_REGID_BYNUM((uint32_t)p, r), \
1.18 @@ -57,6 +58,10 @@
1.19 TRACE( str " [%s.%s: %s]", __VA_ARGS__, \
1.20 io->id, MMIO_REGID_IOBYNUM(io, r), \
1.21 MMIO_REGDESC_IOBYNUM(io, r) )
1.22 +#else
1.23 +#define TRACE_IO( str, p, r, ... )
1.24 +#define TRACE_P4IO( str, io, r, ... )
1.25 +#endif
1.26
1.27 extern struct mem_region mem_rgn[];
1.28 extern struct mmio_region *P4_io[];
1.29 @@ -135,12 +140,6 @@
1.30 pvr2_render_buffer_invalidate(addr, FALSE);
1.31 }
1.32
1.33 - if( IS_MMU_ENABLED() ) {
1.34 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.35 - sh4_stop();
1.36 - return 0;
1.37 - }
1.38 -
1.39 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.40 if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.41 int32_t val;
1.42 @@ -152,7 +151,6 @@
1.43 TRACE_IO( "Long read %08X <= %08X", page, (addr&0xFFF), val, addr );
1.44 return val;
1.45 } else {
1.46 - // fprintf( stderr, "MOV.L %08X <= %08X\n",*(int32_t *)(page+(addr&0xFFF)), addr );
1.47 return *(int32_t *)(page+(addr&0xFFF));
1.48 }
1.49 }
1.50 @@ -173,13 +171,6 @@
1.51 pvr2_render_buffer_invalidate(addr, FALSE);
1.52 }
1.53
1.54 -
1.55 - if( IS_MMU_ENABLED() ) {
1.56 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.57 - sh4_stop();
1.58 - return 0;
1.59 - }
1.60 -
1.61 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.62 if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.63 int32_t val;
1.64 @@ -211,12 +202,6 @@
1.65 }
1.66
1.67
1.68 - if( IS_MMU_ENABLED() ) {
1.69 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.70 - sh4_stop();
1.71 - return 0;
1.72 - }
1.73 -
1.74 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.75 if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.76 int32_t val;
1.77 @@ -253,11 +238,6 @@
1.78 pvr2_render_buffer_invalidate(addr, TRUE);
1.79 }
1.80
1.81 - if( IS_MMU_ENABLED() ) {
1.82 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.83 - sh4_stop();
1.84 - return;
1.85 - }
1.86 if( (addr&0x1FFFFFFF) < 0x200000 ) {
1.87 ERROR( "Attempted write to read-only memory: %08X => %08X", val, addr);
1.88 sh4_stop();
1.89 @@ -302,11 +282,7 @@
1.90 } else if( (addr&0x1F800000) == 0x05000000 ) {
1.91 pvr2_render_buffer_invalidate(addr, TRUE);
1.92 }
1.93 - if( IS_MMU_ENABLED() ) {
1.94 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.95 - sh4_stop();
1.96 - return;
1.97 - }
1.98 +
1.99 if( (addr&0x1FFFFFFF) < 0x200000 ) {
1.100 ERROR( "Attempted write to read-only memory: %08X => %08X", val, addr);
1.101 sh4_stop();
1.102 @@ -346,11 +322,6 @@
1.103 pvr2_render_buffer_invalidate(addr, TRUE);
1.104 }
1.105
1.106 - if( IS_MMU_ENABLED() ) {
1.107 - ERROR( "user-mode & mmu translation not implemented, aborting", NULL );
1.108 - sh4_stop();
1.109 - return;
1.110 - }
1.111 if( (addr&0x1FFFFFFF) < 0x200000 ) {
1.112 ERROR( "Attempted write to read-only memory: %08X => %08X", val, addr);
1.113 sh4_stop();
.