Search
lxdream.org :: lxdream :: r504:61afb3921c4a
lxdream 0.9.1
released Jun 29
Download Now
changeset504:61afb3921c4a lxdream_0_8_1
parent503:36a668469e37
child505:ab23c9a89920
authornkeynes
dateThu Nov 08 12:01:57 2007 +0000 (11 years ago)
Fix ptr->int conversions for 64bit
src/sh4/sh4mem.c
1.1 --- a/src/sh4/sh4mem.c Thu Nov 08 11:55:47 2007 +0000
1.2 +++ b/src/sh4/sh4mem.c Thu Nov 08 12:01:57 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4mem.c,v 1.30 2007-11-08 11:54:16 nkeynes Exp $
1.6 + * $Id: sh4mem.c,v 1.31 2007-11-08 12:01:57 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 @@ -115,13 +115,13 @@
1.11 }
1.12
1.13 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.14 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.15 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.16 if( page == NULL ) {
1.17 WARN( "Attempted word read to missing page: %08X",
1.18 addr );
1.19 return 0;
1.20 }
1.21 - return SIGNEXT16(io_rgn[(uint32_t)page]->io_read(addr&0xFFF));
1.22 + return SIGNEXT16(io_rgn[(uintptr_t)page]->io_read(addr&0xFFF));
1.23 } else {
1.24 return SIGNEXT16(*(int16_t *)(page+(addr&0xFFF)));
1.25 }
1.26 @@ -145,13 +145,13 @@
1.27 }
1.28
1.29 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.30 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.31 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.32 int32_t val;
1.33 if( page == NULL ) {
1.34 WARN( "Attempted long read to missing page: %08X", addr );
1.35 return 0;
1.36 }
1.37 - val = io_rgn[(uint32_t)page]->io_read(addr&0xFFF);
1.38 + val = io_rgn[(uintptr_t)page]->io_read(addr&0xFFF);
1.39 TRACE_IO( "Long read %08X <= %08X", page, (addr&0xFFF), val, addr );
1.40 return val;
1.41 } else {
1.42 @@ -177,13 +177,13 @@
1.43 }
1.44
1.45 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.46 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.47 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.48 int32_t val;
1.49 if( page == NULL ) {
1.50 WARN( "Attempted word read to missing page: %08X", addr );
1.51 return 0;
1.52 }
1.53 - val = SIGNEXT16(io_rgn[(uint32_t)page]->io_read(addr&0xFFF));
1.54 + val = SIGNEXT16(io_rgn[(uintptr_t)page]->io_read(addr&0xFFF));
1.55 TRACE_IO( "Word read %04X <= %08X", page, (addr&0xFFF), val&0xFFFF, addr );
1.56 return val;
1.57 } else {
1.58 @@ -210,13 +210,13 @@
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 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.64 int32_t val;
1.65 if( page == NULL ) {
1.66 WARN( "Attempted byte read to missing page: %08X", addr );
1.67 return 0;
1.68 }
1.69 - val = SIGNEXT8(io_rgn[(uint32_t)page]->io_read(addr&0xFFF));
1.70 + val = SIGNEXT8(io_rgn[(uintptr_t)page]->io_read(addr&0xFFF));
1.71 TRACE_IO( "Byte read %02X <= %08X", page, (addr&0xFFF), val&0xFF, addr );
1.72 return val;
1.73 } else {
1.74 @@ -228,7 +228,6 @@
1.75 {
1.76 sh4ptr_t page;
1.77
1.78 - // fprintf( stderr, "MOV.L %08X => %08X\n", val, addr );
1.79 CHECK_WRITE_WATCH(addr,4,val);
1.80
1.81 if( addr >= 0xE0000000 ) {
1.82 @@ -256,7 +255,7 @@
1.83 asic_g2_write_word();
1.84
1.85 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.86 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.87 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.88 if( page == NULL ) {
1.89 if( (addr & 0x1F000000) >= 0x04000000 &&
1.90 (addr & 0x1F000000) < 0x07000000 )
1.91 @@ -265,7 +264,7 @@
1.92 return;
1.93 }
1.94 TRACE_IO( "Long write %08X => %08X", page, (addr&0xFFF), val, addr );
1.95 - io_rgn[(uint32_t)page]->io_write(addr&0xFFF, val);
1.96 + io_rgn[(uintptr_t)page]->io_write(addr&0xFFF, val);
1.97 } else {
1.98 *(uint32_t *)(page+(addr&0xFFF)) = val;
1.99 }
1.100 @@ -275,7 +274,6 @@
1.101 {
1.102 sh4ptr_t page;
1.103
1.104 - // fprintf( stderr, "MOV.W %04X => %08X\n", val, addr );
1.105 CHECK_WRITE_WATCH(addr,2,val);
1.106
1.107 if( addr >= 0xE0000000 ) {
1.108 @@ -300,13 +298,13 @@
1.109 return;
1.110 }
1.111 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.112 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.113 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.114 if( page == NULL ) {
1.115 WARN( "Attempted word write to missing page: %08X", addr );
1.116 return;
1.117 }
1.118 TRACE_IO( "Word write %04X => %08X", page, (addr&0xFFF), val&0xFFFF, addr );
1.119 - io_rgn[(uint32_t)page]->io_write(addr&0xFFF, val);
1.120 + io_rgn[(uintptr_t)page]->io_write(addr&0xFFF, val);
1.121 } else {
1.122 *(uint16_t *)(page+(addr&0xFFF)) = val;
1.123 }
1.124 @@ -316,7 +314,6 @@
1.125 {
1.126 sh4ptr_t page;
1.127
1.128 - // fprintf( stderr, "MOV.B %02X => %08X\n", val, addr );
1.129 CHECK_WRITE_WATCH(addr,1,val);
1.130
1.131 if( addr >= 0xE0000000 ) {
1.132 @@ -341,13 +338,13 @@
1.133 return;
1.134 }
1.135 page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
1.136 - if( ((uint32_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.137 + if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
1.138 if( page == NULL ) {
1.139 WARN( "Attempted byte write to missing page: %08X", addr );
1.140 return;
1.141 }
1.142 TRACE_IO( "Byte write %02X => %08X", page, (addr&0xFFF), val&0xFF, addr );
1.143 - io_rgn[(uint32_t)page]->io_write( (addr&0xFFF), val);
1.144 + io_rgn[(uintptr_t)page]->io_write( (addr&0xFFF), val);
1.145 } else {
1.146 *(uint8_t *)(page+(addr&0xFFF)) = val;
1.147 }
.