Search
lxdream.org :: lxdream :: r418:b9b14afa0959
lxdream 0.9.1
released Jun 29
Download Now
changeset418:b9b14afa0959
parent417:bd927df302a9
child419:09f85e586ff2
authornkeynes
dateThu Oct 04 08:47:52 2007 +0000 (12 years ago)
Add explicit branch cases for main ram - yes it's faster...
src/sh4/sh4.c
src/sh4/sh4mem.c
1.1 --- a/src/sh4/sh4.c Thu Oct 04 08:47:27 2007 +0000
1.2 +++ b/src/sh4/sh4.c Thu Oct 04 08:47:52 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4.c,v 1.3 2007-10-01 11:51:25 nkeynes Exp $
1.6 + * $Id: sh4.c,v 1.4 2007-10-04 08:47:52 nkeynes Exp $
1.7 *
1.8 * SH4 parent module for all CPU modes and SH4 peripheral
1.9 * modules.
1.10 @@ -48,6 +48,7 @@
1.11 struct sh4_registers sh4r;
1.12 struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];
1.13 int sh4_breakpoint_count = 0;
1.14 +extern char *sh4_main_ram;
1.15
1.16 void sh4_set_use_xlat( gboolean use )
1.17 {
1.18 @@ -63,6 +64,7 @@
1.19 void sh4_init(void)
1.20 {
1.21 register_io_regions( mmio_list_sh4mmio );
1.22 + sh4_main_ram = mem_get_region_by_name(MEM_REGION_MAIN);
1.23 MMU_init();
1.24 sh4_reset();
1.25 }
2.1 --- a/src/sh4/sh4mem.c Thu Oct 04 08:47:27 2007 +0000
2.2 +++ b/src/sh4/sh4mem.c Thu Oct 04 08:47:52 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: sh4mem.c,v 1.24 2007-09-28 07:25:22 nkeynes Exp $
2.6 + * $Id: sh4mem.c,v 1.25 2007-10-04 08:47:52 nkeynes Exp $
2.7 * sh4mem.c is responsible for the SH4's access to memory (including memory
2.8 * mapped I/O), using the page maps created in mem.c
2.9 *
2.10 @@ -65,6 +65,7 @@
2.11
2.12 extern struct mem_region mem_rgn[];
2.13 extern struct mmio_region *P4_io[];
2.14 +char *sh4_main_ram;
2.15
2.16 int32_t sh4_read_p4( uint32_t addr )
2.17 {
2.18 @@ -130,10 +131,11 @@
2.19
2.20 CHECK_READ_WATCH(addr,4);
2.21
2.22 - if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
2.23 + if( addr >= 0xE0000000 ) { /* P4 Area, handled specially */
2.24 return sh4_read_p4( addr );
2.25 -
2.26 - if( (addr&0x1F800000) == 0x04000000 ) {
2.27 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.28 + return *(int32_t *)(sh4_main_ram + (addr&0x00FFFFFF));
2.29 + } else if( (addr&0x1F800000) == 0x04000000 ) {
2.30 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.31 pvr2_render_buffer_invalidate(addr, FALSE);
2.32 } else if( (addr&0x1F800000) == 0x05000000 ) {
2.33 @@ -161,10 +163,11 @@
2.34
2.35 CHECK_READ_WATCH(addr,2);
2.36
2.37 - if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
2.38 + if( addr >= 0xE0000000 ) { /* P4 Area, handled specially */
2.39 return SIGNEXT16(sh4_read_p4( addr ));
2.40 -
2.41 - if( (addr&0x1F800000) == 0x04000000 ) {
2.42 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.43 + return SIGNEXT16(*(int16_t *)(sh4_main_ram + (addr&0x00FFFFFF)));
2.44 + } else if( (addr&0x1F800000) == 0x04000000 ) {
2.45 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.46 pvr2_render_buffer_invalidate(addr, FALSE);
2.47 } else if( (addr&0x1F800000) == 0x05000000 ) {
2.48 @@ -192,9 +195,11 @@
2.49
2.50 CHECK_READ_WATCH(addr,1);
2.51
2.52 - if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
2.53 + if( addr >= 0xE0000000 ) { /* P4 Area, handled specially */
2.54 return SIGNEXT8(sh4_read_p4( addr ));
2.55 - if( (addr&0x1F800000) == 0x04000000 ) {
2.56 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.57 + return SIGNEXT8(*(int8_t *)(sh4_main_ram + (addr&0x00FFFFFF)));
2.58 + } else if( (addr&0x1F800000) == 0x04000000 ) {
2.59 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.60 pvr2_render_buffer_invalidate(addr, FALSE);
2.61 } else if( (addr&0x1F800000) == 0x05000000 ) {
2.62 @@ -213,7 +218,6 @@
2.63 TRACE_IO( "Byte read %02X <= %08X", page, (addr&0xFFF), val&0xFF, addr );
2.64 return val;
2.65 } else {
2.66 - // fprintf( stderr, "MOV.B %02X <= %08X\n",(uint32_t)*(uint8_t *)(page+(addr&0xFFF)), addr );
2.67 return SIGNEXT8(*(int8_t *)(page+(addr&0xFFF)));
2.68 }
2.69 }
2.70 @@ -228,9 +232,11 @@
2.71 if( addr >= 0xE0000000 ) {
2.72 sh4_write_p4( addr, val );
2.73 return;
2.74 - }
2.75 - if( (addr&0x1F800000) == 0x04000000 ||
2.76 - (addr&0x1F800000) == 0x11000000 ) {
2.77 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.78 + *(uint32_t *)(sh4_main_ram + (addr&0x00FFFFFF)) = val;
2.79 + return;
2.80 + } else if( (addr&0x1F800000) == 0x04000000 ||
2.81 + (addr&0x1F800000) == 0x11000000 ) {
2.82 texcache_invalidate_page(addr& 0x7FFFFF);
2.83 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.84 pvr2_render_buffer_invalidate(addr, TRUE);
2.85 @@ -273,8 +279,10 @@
2.86 if( addr >= 0xE0000000 ) {
2.87 sh4_write_p4( addr, (int16_t)val );
2.88 return;
2.89 - }
2.90 - if( (addr&0x1F800000) == 0x04000000 ||
2.91 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.92 + *(uint16_t *)(sh4_main_ram + (addr&0x00FFFFFF)) = val;
2.93 + return;
2.94 + } else if( (addr&0x1F800000) == 0x04000000 ||
2.95 (addr&0x1F800000) == 0x11000000 ) {
2.96 texcache_invalidate_page(addr& 0x7FFFFF);
2.97 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.98 @@ -312,9 +320,11 @@
2.99 if( addr >= 0xE0000000 ) {
2.100 sh4_write_p4( addr, (int8_t)val );
2.101 return;
2.102 - }
2.103 - if( (addr&0x1F800000) == 0x04000000 ||
2.104 - (addr&0x1F800000) == 0x11000000 ) {
2.105 + } else if( (addr&0x1C000000) == 0x0C000000 ) {
2.106 + *(uint8_t *)(sh4_main_ram + (addr&0x00FFFFFF)) = val;
2.107 + return;
2.108 + } else if( (addr&0x1F800000) == 0x04000000 ||
2.109 + (addr&0x1F800000) == 0x11000000 ) {
2.110 texcache_invalidate_page(addr& 0x7FFFFF);
2.111 addr = TRANSLATE_VIDEO_64BIT_ADDRESS(addr);
2.112 pvr2_render_buffer_invalidate(addr, TRUE);
.