Search
lxdream.org :: lxdream/src/sh4/sh4mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4mem.c
changeset 502:c4ecae2b1b5e
prev448:3e5f0c52f0ec
next504:61afb3921c4a
author nkeynes
date Thu Nov 08 11:54:16 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add sh4ptr_t type, start converting bare pointer refs to it
file annotate diff log raw
1.1 --- a/src/sh4/sh4mem.c Tue Oct 16 12:36:59 2007 +0000
1.2 +++ b/src/sh4/sh4mem.c Thu Nov 08 11:54:16 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4mem.c,v 1.29 2007-10-16 12:36:59 nkeynes Exp $
1.6 + * $Id: sh4mem.c,v 1.30 2007-11-08 11:54:16 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 @@ -67,7 +67,7 @@
1.11
1.12 extern struct mem_region mem_rgn[];
1.13 extern struct mmio_region *P4_io[];
1.14 -char *sh4_main_ram;
1.15 +sh4ptr_t sh4_main_ram;
1.16
1.17 int32_t sh4_read_p4( uint32_t addr )
1.18 {
1.19 @@ -106,7 +106,7 @@
1.20
1.21 int32_t sh4_read_phys_word( uint32_t addr )
1.22 {
1.23 - char *page;
1.24 + sh4ptr_t page;
1.25 if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
1.26 return SIGNEXT16(sh4_read_p4( addr ));
1.27
1.28 @@ -129,7 +129,7 @@
1.29
1.30 int32_t sh4_read_long( uint32_t addr )
1.31 {
1.32 - char *page;
1.33 + sh4ptr_t page;
1.34
1.35 CHECK_READ_WATCH(addr,4);
1.36
1.37 @@ -161,7 +161,7 @@
1.38
1.39 int32_t sh4_read_word( uint32_t addr )
1.40 {
1.41 - char *page;
1.42 + sh4ptr_t page;
1.43
1.44 CHECK_READ_WATCH(addr,2);
1.45
1.46 @@ -193,7 +193,7 @@
1.47
1.48 int32_t sh4_read_byte( uint32_t addr )
1.49 {
1.50 - char *page;
1.51 + sh4ptr_t page;
1.52
1.53 CHECK_READ_WATCH(addr,1);
1.54
1.55 @@ -226,7 +226,7 @@
1.56
1.57 void sh4_write_long( uint32_t addr, uint32_t val )
1.58 {
1.59 - char *page;
1.60 + sh4ptr_t page;
1.61
1.62 // fprintf( stderr, "MOV.L %08X => %08X\n", val, addr );
1.63 CHECK_WRITE_WATCH(addr,4,val);
1.64 @@ -273,7 +273,7 @@
1.65
1.66 void sh4_write_word( uint32_t addr, uint32_t val )
1.67 {
1.68 - char *page;
1.69 + sh4ptr_t page;
1.70
1.71 // fprintf( stderr, "MOV.W %04X => %08X\n", val, addr );
1.72 CHECK_WRITE_WATCH(addr,2,val);
1.73 @@ -314,7 +314,7 @@
1.74
1.75 void sh4_write_byte( uint32_t addr, uint32_t val )
1.76 {
1.77 - char *page;
1.78 + sh4ptr_t page;
1.79
1.80 // fprintf( stderr, "MOV.B %02X => %08X\n", val, addr );
1.81 CHECK_WRITE_WATCH(addr,1,val);
1.82 @@ -358,11 +358,11 @@
1.83 /* FIXME: Handle all the many special cases when the range doesn't fall cleanly
1.84 * into the same memory block
1.85 */
1.86 -void mem_copy_from_sh4( unsigned char *dest, uint32_t srcaddr, size_t count ) {
1.87 +void mem_copy_from_sh4( sh4ptr_t dest, uint32_t srcaddr, size_t count ) {
1.88 if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) {
1.89 pvr2_vram64_read( dest, srcaddr, count );
1.90 } else {
1.91 - char *src = mem_get_region(srcaddr);
1.92 + sh4ptr_t src = mem_get_region(srcaddr);
1.93 if( src == NULL ) {
1.94 WARN( "Attempted block read from unknown address %08X", srcaddr );
1.95 } else {
1.96 @@ -371,7 +371,7 @@
1.97 }
1.98 }
1.99
1.100 -void mem_copy_to_sh4( uint32_t destaddr, unsigned char *src, size_t count ) {
1.101 +void mem_copy_to_sh4( uint32_t destaddr, sh4ptr_t src, size_t count ) {
1.102 if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) {
1.103 pvr2_dma_write( destaddr, src, count );
1.104 return;
1.105 @@ -381,7 +381,7 @@
1.106 pvr2_vram64_write( destaddr, src, count );
1.107 return;
1.108 }
1.109 - char *dest = mem_get_region(destaddr);
1.110 + sh4ptr_t dest = mem_get_region(destaddr);
1.111 if( dest == NULL )
1.112 WARN( "Attempted block write to unknown address %08X", destaddr );
1.113 else {
1.114 @@ -394,7 +394,7 @@
1.115 {
1.116 /* Store queue operation */
1.117 int queue = (addr&0x20)>>2;
1.118 - unsigned char *src = (unsigned char *)&sh4r.store_queue[queue];
1.119 + sh4ptr_t src = (sh4ptr_t)&sh4r.store_queue[queue];
1.120 uint32_t hi = (MMIO_READ( MMU, (queue == 0 ? QACR0 : QACR1) ) & 0x1C) << 24;
1.121 uint32_t target = (addr&0x03FFFFE0) | hi;
1.122 mem_copy_to_sh4( target, src, 32 );
.