Search
lxdream.org :: lxdream :: r90:88e4872c2f58
lxdream 0.9.1
released Jun 29
Download Now
changeset90:88e4872c2f58
parent89:939afb9f0f98
child91:61bb3ee00cf8
authornkeynes
dateSun Jan 22 22:42:53 2006 +0000 (14 years ago)
Fix copy_to_sh4 for ta + vram-64 regions
src/sh4/sh4mem.c
1.1 --- a/src/sh4/sh4mem.c Sun Jan 22 22:42:05 2006 +0000
1.2 +++ b/src/sh4/sh4mem.c Sun Jan 22 22:42:53 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4mem.c,v 1.5 2006-01-21 11:38:10 nkeynes Exp $
1.6 + * $Id: sh4mem.c,v 1.6 2006-01-22 22:42:53 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 @@ -30,7 +30,7 @@
1.11 #define OC_BASE 0x1C000000
1.12 #define OC_TOP 0x20000000
1.13
1.14 -#define TRANSLATE_VIDEO_64BIT_ADDRESS(a) ( (((a)&0x00FFFFF8)>>1)|(((a)&0x00000004)<<20)|((a)&0x03)|0x05000000 );
1.15 +#define TRANSLATE_VIDEO_64BIT_ADDRESS(a) ( (((a)&0x00FFFFF8)>>1)|(((a)&0x00000004)<<20)|((a)&0x03)|0x05000000 )
1.16
1.17 #ifdef ENABLE_WATCH
1.18 #define CHECK_READ_WATCH( addr, size ) \
1.19 @@ -319,6 +319,35 @@
1.20 }
1.21
1.22 void mem_copy_to_sh4( uint32_t destaddr, char *src, size_t count ) {
1.23 - char *dest = mem_get_region(destaddr);
1.24 - memcpy( dest, src, count );
1.25 + if( destaddr >= 0x10000000 && destaddr < 0x20000000 ) {
1.26 + pvr2ta_write( src, count );
1.27 + } else if( destaddr >= 04000000 && destaddr < 0x5000000 ) {
1.28 + /* 64-bit video write. Oh. Yuck */
1.29 + uint32_t *dest32[2];
1.30 + uint32_t *src32 = (uint32_t *)src;
1.31 + int flag = 0;
1.32 + if( destaddr & 0x03 != 0 ) {
1.33 + }
1.34 + dest32[0] = (uint32_t *)mem_get_region(TRANSLATE_VIDEO_64BIT_ADDRESS(destaddr));
1.35 + dest32[1] = (uint32_t *)mem_get_region(TRANSLATE_VIDEO_64BIT_ADDRESS(destaddr+4));
1.36 + while( count >= 4 ) {
1.37 + *dest32[flag]++ = *src32++;
1.38 + flag = !flag;
1.39 + count -=4;
1.40 + }
1.41 + if( count != 0 ) {
1.42 + src = (char *)src32;
1.43 + char *dest = dest32[flag];
1.44 + do {
1.45 + *dest++ = *src++;
1.46 + count--;
1.47 + } while( count > 0 );
1.48 + }
1.49 + } else {
1.50 + char *dest = mem_get_region(destaddr);
1.51 + if( dest == NULL )
1.52 + ERROR( "Attempted block write to undefined region %08X", destaddr );
1.53 + else
1.54 + memcpy( dest, src, count );
1.55 + }
1.56 }
.