Search
lxdream.org :: lxdream/src/sh4/sh4mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4mem.c
changeset 527:14c9489f647e
prev504:61afb3921c4a
next550:a27e31340147
author nkeynes
date Sun Nov 18 11:12:44 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change x86-64 translator work-in-progress
file annotate diff log raw
1.1 --- a/src/sh4/sh4mem.c Thu Nov 08 12:01:57 2007 +0000
1.2 +++ b/src/sh4/sh4mem.c Sun Nov 18 11:12:44 2007 +0000
1.3 @@ -69,7 +69,7 @@
1.4 extern struct mmio_region *P4_io[];
1.5 sh4ptr_t sh4_main_ram;
1.6
1.7 -int32_t sh4_read_p4( uint32_t addr )
1.8 +int32_t sh4_read_p4( sh4addr_t addr )
1.9 {
1.10 struct mmio_region *io = P4_io[(addr&0x1FFFFFFF)>>19];
1.11 if( !io ) {
1.12 @@ -86,7 +86,7 @@
1.13 }
1.14 }
1.15
1.16 -void sh4_write_p4( uint32_t addr, int32_t val )
1.17 +void sh4_write_p4( sh4addr_t addr, int32_t val )
1.18 {
1.19 struct mmio_region *io = P4_io[(addr&0x1FFFFFFF)>>19];
1.20 if( !io ) {
1.21 @@ -104,7 +104,7 @@
1.22 }
1.23 }
1.24
1.25 -int32_t sh4_read_phys_word( uint32_t addr )
1.26 +int32_t sh4_read_phys_word( sh4addr_t addr )
1.27 {
1.28 sh4ptr_t page;
1.29 if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
1.30 @@ -127,7 +127,16 @@
1.31 }
1.32 }
1.33
1.34 -int32_t sh4_read_long( uint32_t addr )
1.35 +/**
1.36 + * Convenience function to read a quad-word (implemented as two long reads).
1.37 + */
1.38 +int64_t sh4_read_quad( sh4addr_t addr )
1.39 +{
1.40 + return ((int64_t)((uint32_t)sh4_read_long(addr))) |
1.41 + (((int64_t)((uint32_t)sh4_read_long(addr+4))) << 32);
1.42 +}
1.43 +
1.44 +int32_t sh4_read_long( sh4addr_t addr )
1.45 {
1.46 sh4ptr_t page;
1.47
1.48 @@ -159,7 +168,7 @@
1.49 }
1.50 }
1.51
1.52 -int32_t sh4_read_word( uint32_t addr )
1.53 +int32_t sh4_read_word( sh4addr_t addr )
1.54 {
1.55 sh4ptr_t page;
1.56
1.57 @@ -191,7 +200,7 @@
1.58 }
1.59 }
1.60
1.61 -int32_t sh4_read_byte( uint32_t addr )
1.62 +int32_t sh4_read_byte( sh4addr_t addr )
1.63 {
1.64 sh4ptr_t page;
1.65
1.66 @@ -224,7 +233,16 @@
1.67 }
1.68 }
1.69
1.70 -void sh4_write_long( uint32_t addr, uint32_t val )
1.71 +/**
1.72 + * Convenience function to write a quad-word (implemented as two long writes).
1.73 + */
1.74 +void sh4_write_quad( sh4addr_t addr, uint64_t val )
1.75 +{
1.76 + sh4_write_long( addr, (uint32_t)val );
1.77 + sh4_write_long( addr+4, (uint32_t)(val>>32) );
1.78 +}
1.79 +
1.80 +void sh4_write_long( sh4addr_t addr, uint32_t val )
1.81 {
1.82 sh4ptr_t page;
1.83
1.84 @@ -270,7 +288,7 @@
1.85 }
1.86 }
1.87
1.88 -void sh4_write_word( uint32_t addr, uint32_t val )
1.89 +void sh4_write_word( sh4addr_t addr, uint32_t val )
1.90 {
1.91 sh4ptr_t page;
1.92
1.93 @@ -310,7 +328,7 @@
1.94 }
1.95 }
1.96
1.97 -void sh4_write_byte( uint32_t addr, uint32_t val )
1.98 +void sh4_write_byte( sh4addr_t addr, uint32_t val )
1.99 {
1.100 sh4ptr_t page;
1.101
1.102 @@ -355,7 +373,7 @@
1.103 /* FIXME: Handle all the many special cases when the range doesn't fall cleanly
1.104 * into the same memory block
1.105 */
1.106 -void mem_copy_from_sh4( sh4ptr_t dest, uint32_t srcaddr, size_t count ) {
1.107 +void mem_copy_from_sh4( sh4ptr_t dest, sh4addr_t srcaddr, size_t count ) {
1.108 if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) {
1.109 pvr2_vram64_read( dest, srcaddr, count );
1.110 } else {
1.111 @@ -368,7 +386,7 @@
1.112 }
1.113 }
1.114
1.115 -void mem_copy_to_sh4( uint32_t destaddr, sh4ptr_t src, size_t count ) {
1.116 +void mem_copy_to_sh4( sh4addr_t destaddr, sh4ptr_t src, size_t count ) {
1.117 if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) {
1.118 pvr2_dma_write( destaddr, src, count );
1.119 return;
1.120 @@ -387,7 +405,7 @@
1.121 }
1.122 }
1.123
1.124 -void sh4_flush_store_queue( uint32_t addr )
1.125 +void sh4_flush_store_queue( sh4addr_t addr )
1.126 {
1.127 /* Store queue operation */
1.128 int queue = (addr&0x20)>>2;
.