Search
lxdream.org :: lxdream :: r502:c4ecae2b1b5e
lxdream 0.9.1
released Jun 29
Download Now
changeset502:c4ecae2b1b5e
parent501:41328c68bd73
child503:36a668469e37
authornkeynes
dateThu Nov 08 11:54:16 2007 +0000 (12 years ago)
Add sh4ptr_t type, start converting bare pointer refs to it
src/aica/armmem.c
src/bios.c
src/bootstrap.c
src/bootstrap.h
src/dcload.c
src/display.h
src/loader.c
src/lxdream.h
src/maple/controller.c
src/maple/maple.h
src/mem.c
src/mem.h
src/pvr2/pvr2.c
src/pvr2/pvr2mem.c
src/sh4/dmac.c
src/sh4/sh4.c
src/sh4/sh4mem.c
src/sh4/sh4mmio.c
src/sh4/sh4x86.c
src/sh4/sh4x86.in
src/sh4/xltcache.c
src/util.c
1.1 --- a/src/aica/armmem.c Thu Nov 08 11:53:56 2007 +0000
1.2 +++ b/src/aica/armmem.c Thu Nov 08 11:54:16 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: armmem.c,v 1.8 2007-10-09 08:11:51 nkeynes Exp $
1.6 + * $Id: armmem.c,v 1.9 2007-11-08 11:54:16 nkeynes Exp $
1.7 *
1.8 * Implements the ARM's memory map.
1.9 *
1.10 @@ -21,8 +21,8 @@
1.11 #include "mem.h"
1.12 #include "aica.h"
1.13
1.14 -char *arm_mem = NULL;
1.15 -char *arm_mem_scratch = NULL;
1.16 +unsigned char *arm_mem = NULL;
1.17 +unsigned char *arm_mem_scratch = NULL;
1.18
1.19 void arm_mem_init() {
1.20 arm_mem = mem_get_region_by_name( MEM_REGION_AUDIO );
2.1 --- a/src/bios.c Thu Nov 08 11:53:56 2007 +0000
2.2 +++ b/src/bios.c Thu Nov 08 11:54:16 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: bios.c,v 1.4 2007-10-08 12:06:01 nkeynes Exp $
2.6 + * $Id: bios.c,v 1.5 2007-11-08 11:54:16 nkeynes Exp $
2.7 *
2.8 * "Fake" BIOS functions, for operation without the actual BIOS.
2.9 *
2.10 @@ -55,7 +55,7 @@
2.11 typedef struct gdrom_command {
2.12 int status;
2.13 uint32_t cmd_code;
2.14 - char *data;
2.15 + sh4ptr_t data;
2.16 uint32_t result[4];
2.17 } *gdrom_command_t;
2.18
2.19 @@ -86,7 +86,7 @@
2.20 memset( &gdrom_cmd_queue, 0, sizeof(gdrom_cmd_queue) );
2.21 }
2.22
2.23 -uint32_t bios_gdrom_enqueue( uint32_t cmd, char *ptr )
2.24 +uint32_t bios_gdrom_enqueue( uint32_t cmd, sh4ptr_t ptr )
2.25 {
2.26 int i;
2.27 for( i=0; i<COMMAND_QUEUE_LENGTH; i++ ) {
2.28 @@ -151,7 +151,7 @@
2.29 sh4r.r[0] = cmd->status;
2.30 if( cmd->status == GD_CMD_STATUS_ERROR &&
2.31 sh4r.r[5] != 0 ) {
2.32 - mem_copy_to_sh4( sh4r.r[5], (unsigned char *)&cmd->result, sizeof(cmd->result) );
2.33 + mem_copy_to_sh4( sh4r.r[5], (sh4ptr_t)&cmd->result, sizeof(cmd->result) );
2.34 }
2.35 }
2.36 break;
2.37 @@ -163,7 +163,7 @@
2.38 break;
2.39 case 4: /* Drive status */
2.40 if( sh4r.r[4] != 0 ) {
2.41 - mem_copy_to_sh4( sh4r.r[4], (unsigned char *)&bios_gdrom_status,
2.42 + mem_copy_to_sh4( sh4r.r[4], (sh4ptr_t)&bios_gdrom_status,
2.43 sizeof(bios_gdrom_status) );
2.44 }
2.45 sh4r.r[0] = 0;
3.1 --- a/src/bootstrap.c Thu Nov 08 11:53:56 2007 +0000
3.2 +++ b/src/bootstrap.c Thu Nov 08 11:54:16 2007 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: bootstrap.c,v 1.8 2007-10-11 08:22:03 nkeynes Exp $
3.6 + * $Id: bootstrap.c,v 1.9 2007-11-08 11:54:16 nkeynes Exp $
3.7 *
3.8 * CD Bootstrap header parsing. Mostly for informational purposes.
3.9 *
3.10 @@ -106,7 +106,7 @@
3.11 * @param detail true to include a ful information dump, false for just
3.12 * the facts, maam.
3.13 */
3.14 -void bootstrap_dump( unsigned char *data, gboolean detail )
3.15 +void bootstrap_dump( void *data, gboolean detail )
3.16 {
3.17 struct dc_bootstrap_head *head;
3.18 int i, got, periph, crc, hcrc;
4.1 --- a/src/bootstrap.h Thu Nov 08 11:53:56 2007 +0000
4.2 +++ b/src/bootstrap.h Thu Nov 08 11:54:16 2007 +0000
4.3 @@ -1,5 +1,5 @@
4.4 /**
4.5 - * $Id: bootstrap.h,v 1.5 2007-10-06 08:59:42 nkeynes Exp $
4.6 + * $Id: bootstrap.h,v 1.6 2007-11-08 11:54:16 nkeynes Exp $
4.7 *
4.8 * CD Bootstrap header parsing. Mostly for informational purposes.
4.9 *
4.10 @@ -32,7 +32,7 @@
4.11 * Dump the bootstrap info to the output log for infomational/debugging
4.12 * purposes.
4.13 */
4.14 -void bootstrap_dump(unsigned char *data, gboolean detail);
4.15 +void bootstrap_dump(void *data, gboolean detail);
4.16
4.17 #ifdef __cplusplus
4.18 }
5.1 --- a/src/dcload.c Thu Nov 08 11:53:56 2007 +0000
5.2 +++ b/src/dcload.c Thu Nov 08 11:54:16 2007 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: dcload.c,v 1.7 2007-10-06 08:59:42 nkeynes Exp $
5.6 + * $Id: dcload.c,v 1.8 2007-11-08 11:54:16 nkeynes Exp $
5.7 *
5.8 * DC-load syscall implementation.
5.9 *
5.10 @@ -86,7 +86,7 @@
5.11 if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
5.12 sh4r.r[0] = -1;
5.13 } else {
5.14 - char *buf = mem_get_region( sh4r.r[6] );
5.15 + sh4ptr_t buf = mem_get_region( sh4r.r[6] );
5.16 int length = sh4r.r[7];
5.17 sh4r.r[0] = read( open_fds[fd], buf, length );
5.18 }
5.19 @@ -96,7 +96,7 @@
5.20 if( fd < 0 || fd >= MAX_OPEN_FDS || open_fds[fd] == -1 ) {
5.21 sh4r.r[0] = -1;
5.22 } else {
5.23 - char *buf = mem_get_region( sh4r.r[6] );
5.24 + sh4ptr_t buf = mem_get_region( sh4r.r[6] );
5.25 int length = sh4r.r[7];
5.26 sh4r.r[0] = write( open_fds[fd], buf, length );
5.27 }
5.28 @@ -117,7 +117,7 @@
5.29 if( fd == -1 ) {
5.30 sh4r.r[0] = -1;
5.31 } else {
5.32 - char *filename = mem_get_region( sh4r.r[5] );
5.33 + char *filename = (char *)mem_get_region( sh4r.r[5] );
5.34 int realfd = open( filename, sh4r.r[6] );
5.35 open_fds[fd] = realfd;
5.36 sh4r.r[0] = realfd;
6.1 --- a/src/display.h Thu Nov 08 11:53:56 2007 +0000
6.2 +++ b/src/display.h Thu Nov 08 11:54:16 2007 +0000
6.3 @@ -1,5 +1,5 @@
6.4 /**
6.5 - * $Id: display.h,v 1.11 2007-10-31 09:10:23 nkeynes Exp $
6.6 + * $Id: display.h,v 1.12 2007-11-08 11:54:16 nkeynes Exp $
6.7 *
6.8 * The PC side of the video support (responsible for actually displaying /
6.9 * rendering frames)
6.10 @@ -80,7 +80,7 @@
6.11 sh4addr_t address;
6.12 uint32_t size; /* Size of buffer in bytes, must be width*height*bpp */
6.13 gboolean inverted;/* True if the buffer is upside down */
6.14 - char *data;
6.15 + unsigned char *data;
6.16 };
6.17
6.18 /**
7.1 --- a/src/loader.c Thu Nov 08 11:53:56 2007 +0000
7.2 +++ b/src/loader.c Thu Nov 08 11:54:16 2007 +0000
7.3 @@ -1,5 +1,5 @@
7.4 /**
7.5 - * $Id: loader.c,v 1.21 2007-10-31 12:05:23 nkeynes Exp $
7.6 + * $Id: loader.c,v 1.22 2007-11-08 11:54:16 nkeynes Exp $
7.7 *
7.8 * File loading routines, mostly for loading demos without going through the
7.9 * whole procedure of making a CD image for them.
7.10 @@ -75,7 +75,7 @@
7.11 if( memcmp( buf, bootstrap_magic, 32 ) == 0 ) {
7.12 /* we have a DC bootstrap */
7.13 if( st.st_size == BOOTSTRAP_SIZE ) {
7.14 - unsigned char *load = (unsigned char *)mem_get_region( BOOTSTRAP_LOAD_ADDR );
7.15 + sh4ptr_t load = mem_get_region( BOOTSTRAP_LOAD_ADDR );
7.16 lseek( fd, 0, SEEK_SET );
7.17 read( fd, load, BOOTSTRAP_SIZE );
7.18 bootstrap_dump( load, TRUE );
7.19 @@ -167,7 +167,7 @@
7.20 read( fd, &phdr, sizeof(phdr) );
7.21 if( phdr.p_type == PT_LOAD ) {
7.22 lseek( fd, phdr.p_offset, SEEK_SET );
7.23 - char *target = mem_get_region( phdr.p_vaddr );
7.24 + sh4ptr_t target = mem_get_region( phdr.p_vaddr );
7.25 read( fd, target, phdr.p_filesz );
7.26 if( phdr.p_memsz > phdr.p_filesz ) {
7.27 memset( target + phdr.p_filesz, 0, phdr.p_memsz - phdr.p_filesz );
8.1 --- a/src/lxdream.h Thu Nov 08 11:53:56 2007 +0000
8.2 +++ b/src/lxdream.h Thu Nov 08 11:54:16 2007 +0000
8.3 @@ -1,5 +1,5 @@
8.4 /**
8.5 - * $Id: lxdream.h,v 1.1 2007-10-31 09:10:23 nkeynes Exp $
8.6 + * $Id: lxdream.h,v 1.2 2007-11-08 11:54:16 nkeynes Exp $
8.7 *
8.8 * Common type definitions and forward declarations
8.9 *
8.10 @@ -36,8 +36,14 @@
8.11 #define max(a,b) ( (a) > (b) ? (a) : (b) )
8.12 #endif
8.13
8.14 -
8.15 +/**
8.16 + * A 32-bit address in SH4 space
8.17 + */
8.18 typedef uint32_t sh4addr_t;
8.19 +/**
8.20 + * A direct pointer into SH4 memory
8.21 + */
8.22 +typedef unsigned char *sh4ptr_t;
8.23
8.24 /******************* Forward type declarations ******************/
8.25
9.1 --- a/src/maple/controller.c Thu Nov 08 11:53:56 2007 +0000
9.2 +++ b/src/maple/controller.c Thu Nov 08 11:54:16 2007 +0000
9.3 @@ -1,5 +1,5 @@
9.4 /**
9.5 - * $Id: controller.c,v 1.9 2007-10-23 10:47:17 nkeynes Exp $
9.6 + * $Id: controller.c,v 1.10 2007-11-08 11:54:16 nkeynes Exp $
9.7 *
9.8 * Implements the standard dreamcast controller
9.9 *
9.10 @@ -32,7 +32,7 @@
9.11 maple_device_t controller_new();
9.12 lxdream_config_entry_t controller_get_config( maple_device_t dev );
9.13 int controller_get_cond( maple_device_t dev, int function, unsigned char *outbuf,
9.14 - int *outlen );
9.15 + unsigned int *outlen );
9.16
9.17 typedef struct controller_device {
9.18 struct maple_device dev;
9.19 @@ -187,7 +187,7 @@
9.20
9.21
9.22 int controller_get_cond( maple_device_t mdev, int function, unsigned char *outbuf,
9.23 - int *outlen )
9.24 + unsigned int *outlen )
9.25 {
9.26 controller_device_t dev = (controller_device_t)mdev;
9.27 if( function == MAPLE_FUNC_CONTROLLER ) {
10.1 --- a/src/maple/maple.h Thu Nov 08 11:53:56 2007 +0000
10.2 +++ b/src/maple/maple.h Thu Nov 08 11:54:16 2007 +0000
10.3 @@ -1,5 +1,5 @@
10.4 /**
10.5 - * $Id: maple.h,v 1.9 2007-10-31 11:53:35 nkeynes Exp $
10.6 + * $Id: maple.h,v 1.10 2007-11-08 11:54:16 nkeynes Exp $
10.7 *
10.8 * Maple bus definitions
10.9 *
10.10 @@ -79,13 +79,13 @@
10.11 int (*reset)(struct maple_device *dev);
10.12 int (*shutdown)(struct maple_device *dev);
10.13 int (*get_condition)(struct maple_device *dev,
10.14 - int function, unsigned char *outbuf, int *buflen);
10.15 + int function, unsigned char *outbuf, unsigned int *buflen);
10.16 int (*set_condition)(struct maple_device *dev,
10.17 - int function, unsigned char *inbuf, int buflen);
10.18 + int function, unsigned char *inbuf, unsigned int buflen);
10.19 int (*read_block)(struct maple_device *dev,
10.20 - int function, uint32_t block, unsigned char *outbuf, int *buflen);
10.21 + int function, uint32_t block, unsigned char *outbuf, unsigned int *buflen);
10.22 int (*write_block)(struct maple_device *dev,
10.23 - int function, uint32_t block, unsigned char *inbuf, int buflen);
10.24 + int function, uint32_t block, unsigned char *inbuf, unsigned int buflen);
10.25 };
10.26
10.27 extern struct maple_device_class controller_class;
11.1 --- a/src/mem.c Thu Nov 08 11:53:56 2007 +0000
11.2 +++ b/src/mem.c Thu Nov 08 11:54:16 2007 +0000
11.3 @@ -1,5 +1,5 @@
11.4 /**
11.5 - * $Id: mem.c,v 1.21 2007-11-04 08:49:18 nkeynes Exp $
11.6 + * $Id: mem.c,v 1.22 2007-11-08 11:54:16 nkeynes Exp $
11.7 * mem.c is responsible for creating and maintaining the overall system memory
11.8 * map, as visible from the SH4 processor.
11.9 *
11.10 @@ -34,7 +34,7 @@
11.11 #include "mmio.h"
11.12 #include "dreamcast.h"
11.13
11.14 -char **page_map = NULL;
11.15 +sh4ptr_t *page_map = NULL;
11.16
11.17 int mem_load(FILE *f);
11.18 void mem_save(FILE *f);
11.19 @@ -163,7 +163,7 @@
11.20
11.21 int mem_save_block( const gchar *file, uint32_t start, uint32_t length )
11.22 {
11.23 - char *region;
11.24 + sh4ptr_t region;
11.25 int len = 4096, total = 0;
11.26 uint32_t addr = start;
11.27 FILE *f = fopen(file,"w");
11.28 @@ -191,7 +191,7 @@
11.29
11.30 int mem_load_block( const gchar *file, uint32_t start, uint32_t length )
11.31 {
11.32 - char *region;
11.33 + sh4ptr_t region;
11.34 int len = 4096, total = 0;
11.35 uint32_t addr = start;
11.36 struct stat st;
11.37 @@ -269,7 +269,7 @@
11.38 void *mem_load_rom( const gchar *file, uint32_t base, uint32_t size, uint32_t crc,
11.39 const gchar *region_name )
11.40 {
11.41 - char *mem;
11.42 + sh4ptr_t mem;
11.43 uint32_t calc_crc;
11.44 int status;
11.45
11.46 @@ -290,7 +290,7 @@
11.47
11.48 if( status == 0 ) {
11.49 /* CRC check only if we loaded something */
11.50 - calc_crc = crc32(0L, (unsigned char *)mem, size);
11.51 + calc_crc = crc32(0L, (sh4ptr_t)mem, size);
11.52 if( calc_crc != crc ) {
11.53 WARN( "Bios CRC Mismatch in %s: %08X (expected %08X)",
11.54 file, calc_crc, crc);
11.55 @@ -300,7 +300,7 @@
11.56 return mem;
11.57 }
11.58
11.59 -char *mem_get_region_by_name( const char *name )
11.60 +sh4ptr_t mem_get_region_by_name( const char *name )
11.61 {
11.62 int i;
11.63 for( i=0; i<num_mem_rgns; i++ ) {
11.64 @@ -330,7 +330,7 @@
11.65 /* P4 area (on-chip I/O channels */
11.66 P4_io[(io->base&0x1FFFFFFF)>>19] = io;
11.67 } else {
11.68 - page_map[io->base>>12] = (char *)num_io_rgns;
11.69 + page_map[io->base>>12] = (sh4ptr_t )num_io_rgns;
11.70 }
11.71 io_rgn[num_io_rgns] = io;
11.72 num_io_rgns++;
11.73 @@ -343,19 +343,19 @@
11.74
11.75 int mem_has_page( uint32_t addr )
11.76 {
11.77 - char *page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.78 + sh4ptr_t page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.79 return page != NULL;
11.80 }
11.81
11.82 -char *mem_get_page( uint32_t addr )
11.83 +sh4ptr_t mem_get_page( uint32_t addr )
11.84 {
11.85 - char *page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.86 + sh4ptr_t page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.87 return page;
11.88 }
11.89
11.90 -char *mem_get_region( uint32_t addr )
11.91 +sh4ptr_t mem_get_region( uint32_t addr )
11.92 {
11.93 - char *page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.94 + sh4ptr_t page = page_map[ (addr & 0x1FFFFFFF) >> 12 ];
11.95 if( ((uintptr_t)page) < MAX_IO_REGIONS ) { /* IO Region */
11.96 return NULL;
11.97 } else {
11.98 @@ -368,7 +368,7 @@
11.99 if( addr > 0xFF000000 ) {
11.100 return P4_io[(addr&0x00FFFFFF)>>12];
11.101 }
11.102 - char *page = page_map[(addr&0x1FFFFFFF)>>12];
11.103 + sh4ptr_t page = page_map[(addr&0x1FFFFFFF)>>12];
11.104 if( ((uintptr_t)page) < MAX_IO_REGIONS ) {
11.105 return io_rgn[(uintptr_t)page];
11.106 } else {
12.1 --- a/src/mem.h Thu Nov 08 11:53:56 2007 +0000
12.2 +++ b/src/mem.h Thu Nov 08 11:54:16 2007 +0000
12.3 @@ -1,5 +1,5 @@
12.4 /**
12.5 - * $Id: mem.h,v 1.15 2007-10-31 09:10:23 nkeynes Exp $
12.6 + * $Id: mem.h,v 1.16 2007-11-08 11:54:16 nkeynes Exp $
12.7 *
12.8 * mem is responsible for creating and maintaining the overall system memory
12.9 * map, as visible from the SH4 processor. (Note the ARM has a different map)
12.10 @@ -31,7 +31,7 @@
12.11 uint32_t base;
12.12 uint32_t size;
12.13 const char *name;
12.14 - char *mem;
12.15 + sh4ptr_t mem;
12.16 int flags;
12.17 } *mem_region_t;
12.18
12.19 @@ -51,17 +51,17 @@
12.20 void *mem_load_rom( const gchar *name, uint32_t base, uint32_t size, uint32_t crc,
12.21 const gchar *region_name );
12.22 void *mem_alloc_pages( int n );
12.23 -char *mem_get_region( uint32_t addr );
12.24 -char *mem_get_region_by_name( const char *name );
12.25 +sh4ptr_t mem_get_region( uint32_t addr );
12.26 +sh4ptr_t mem_get_region_by_name( const char *name );
12.27 int mem_has_page( uint32_t addr );
12.28 -char *mem_get_page( uint32_t addr );
12.29 +sh4ptr_t mem_get_page( uint32_t addr );
12.30 int mem_load_block( const gchar *filename, uint32_t base, uint32_t size );
12.31 int mem_save_block( const gchar *filename, uint32_t base, uint32_t size );
12.32 void mem_set_trace( uint32_t addr, int flag );
12.33 void mem_init( void );
12.34 void mem_reset( void );
12.35 -void mem_copy_from_sh4( unsigned char *dest, sh4addr_t src, size_t count );
12.36 -void mem_copy_to_sh4( sh4addr_t dest, unsigned char *src, size_t count );
12.37 +void mem_copy_from_sh4( sh4ptr_t dest, sh4addr_t src, size_t count );
12.38 +void mem_copy_to_sh4( sh4addr_t dest, sh4ptr_t src, size_t count );
12.39
12.40 #define ENABLE_DEBUG_MODE 1
12.41
12.42 @@ -90,7 +90,7 @@
12.43 void mem_delete_watch( watch_point_t watch );
12.44 watch_point_t mem_is_watched( uint32_t addr, int size, int op );
12.45
12.46 -extern char **page_map;
12.47 +extern sh4ptr_t *page_map;
12.48 #ifdef __cplusplus
12.49 }
12.50 #endif
13.1 --- a/src/pvr2/pvr2.c Thu Nov 08 11:53:56 2007 +0000
13.2 +++ b/src/pvr2/pvr2.c Thu Nov 08 11:54:16 2007 +0000
13.3 @@ -1,5 +1,5 @@
13.4 /**
13.5 - * $Id: pvr2.c,v 1.48 2007-10-31 09:10:23 nkeynes Exp $
13.6 + * $Id: pvr2.c,v 1.49 2007-11-08 11:54:16 nkeynes Exp $
13.7 *
13.8 * PVR2 (Video) Core module implementation and MMIO registers.
13.9 *
13.10 @@ -29,7 +29,7 @@
13.11 #define MMIO_IMPL
13.12 #include "pvr2/pvr2mmio.h"
13.13
13.14 -char *video_base;
13.15 +unsigned char *video_base;
13.16
13.17 #define MAX_RENDER_BUFFERS 4
13.18
14.1 --- a/src/pvr2/pvr2mem.c Thu Nov 08 11:53:56 2007 +0000
14.2 +++ b/src/pvr2/pvr2mem.c Thu Nov 08 11:54:16 2007 +0000
14.3 @@ -1,5 +1,5 @@
14.4 /**
14.5 - * $Id: pvr2mem.c,v 1.11 2007-10-31 09:10:23 nkeynes Exp $
14.6 + * $Id: pvr2mem.c,v 1.12 2007-11-08 11:54:16 nkeynes Exp $
14.7 *
14.8 * PVR2 (Video) VRAM handling routines (mainly for the 64-bit region)
14.9 *
14.10 @@ -37,7 +37,7 @@
14.11 if( region == 0 ) {
14.12 pvr2_vram64_write( destaddr, src, count );
14.13 } else {
14.14 - char *dest = mem_get_region(destaddr);
14.15 + unsigned char *dest = mem_get_region(destaddr);
14.16 memcpy( dest, src, count );
14.17 }
14.18 break;
14.19 @@ -51,7 +51,7 @@
14.20 if( region == 0 ) {
14.21 pvr2_vram64_write( destaddr, src, count );
14.22 } else {
14.23 - char *dest = mem_get_region(destaddr);
14.24 + unsigned char *dest = mem_get_region(destaddr);
14.25 memcpy( dest, src, count );
14.26 }
14.27 }
15.1 --- a/src/sh4/dmac.c Thu Nov 08 11:53:56 2007 +0000
15.2 +++ b/src/sh4/dmac.c Thu Nov 08 11:54:16 2007 +0000
15.3 @@ -1,5 +1,5 @@
15.4 /**
15.5 - * $Id: dmac.c,v 1.3 2007-10-08 12:06:01 nkeynes Exp $
15.6 + * $Id: dmac.c,v 1.4 2007-11-08 11:54:16 nkeynes Exp $
15.7 *
15.8 * SH4 onboard DMA controller (DMAC) peripheral.
15.9 *
15.10 @@ -170,7 +170,7 @@
15.11 *
15.12 * @return the number of bytes actually transferred.
15.13 */
15.14 -uint32_t DMAC_get_buffer( int channel, unsigned char *buf, uint32_t numBytes )
15.15 +uint32_t DMAC_get_buffer( int channel, sh4ptr_t buf, uint32_t numBytes )
15.16 {
15.17 uint32_t control = DMA_CONTROL(channel);
15.18 uint32_t source, count, run_count, size, i;
15.19 @@ -195,7 +195,7 @@
15.20 run_count = count;
15.21
15.22 /* Do copy - FIXME: doesn't work when crossing regions */
15.23 - char *region = mem_get_region( source );
15.24 + sh4ptr_t region = mem_get_region( source );
15.25 switch( (control >> 12) & 0x03 ) {
15.26 case 0:
15.27 memcpy( tmp, region, size );
15.28 @@ -235,7 +235,7 @@
15.29 return run_count * size;
15.30 }
15.31
15.32 -uint32_t DMAC_put_buffer( int channel, unsigned char *buf, uint32_t numBytes )
15.33 +uint32_t DMAC_put_buffer( int channel, sh4ptr_t buf, uint32_t numBytes )
15.34 {
15.35 uint32_t control = DMA_CONTROL(channel);
15.36 uint32_t dest, count, run_count, size, i;
15.37 @@ -258,7 +258,7 @@
15.38 run_count = count;
15.39
15.40 /* Do copy - FIXME: doesn't work when crossing regions */
15.41 - char *region = mem_get_region( dest );
15.42 + sh4ptr_t region = mem_get_region( dest );
15.43 switch( (control >> 12) & 0x03 ) {
15.44 case 0:
15.45 for( i=0; i<run_count; i++ ) {
16.1 --- a/src/sh4/sh4.c Thu Nov 08 11:53:56 2007 +0000
16.2 +++ b/src/sh4/sh4.c Thu Nov 08 11:54:16 2007 +0000
16.3 @@ -1,5 +1,5 @@
16.4 /**
16.5 - * $Id: sh4.c,v 1.6 2007-10-31 09:02:18 nkeynes Exp $
16.6 + * $Id: sh4.c,v 1.7 2007-11-08 11:54:16 nkeynes Exp $
16.7 *
16.8 * SH4 parent module for all CPU modes and SH4 peripheral
16.9 * modules.
16.10 @@ -52,7 +52,7 @@
16.11 struct sh4_registers sh4r;
16.12 struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];
16.13 int sh4_breakpoint_count = 0;
16.14 -extern char *sh4_main_ram;
16.15 +extern sh4ptr_t sh4_main_ram;
16.16
16.17 void sh4_set_use_xlat( gboolean use )
16.18 {
16.19 @@ -106,6 +106,11 @@
16.20
16.21 void sh4_stop(void)
16.22 {
16.23 + if( sh4_module.run_time_slice == sh4_xlat_run_slice ) {
16.24 + /* If we were running with the translator, update new_pc and in_delay_slot */
16.25 + sh4r.new_pc = sh4r.pc+2;
16.26 + sh4r.in_delay_slot = FALSE;
16.27 + }
16.28
16.29 }
16.30
17.1 --- a/src/sh4/sh4mem.c Thu Nov 08 11:53:56 2007 +0000
17.2 +++ b/src/sh4/sh4mem.c Thu Nov 08 11:54:16 2007 +0000
17.3 @@ -1,5 +1,5 @@
17.4 /**
17.5 - * $Id: sh4mem.c,v 1.29 2007-10-16 12:36:59 nkeynes Exp $
17.6 + * $Id: sh4mem.c,v 1.30 2007-11-08 11:54:16 nkeynes Exp $
17.7 * sh4mem.c is responsible for the SH4's access to memory (including memory
17.8 * mapped I/O), using the page maps created in mem.c
17.9 *
17.10 @@ -67,7 +67,7 @@
17.11
17.12 extern struct mem_region mem_rgn[];
17.13 extern struct mmio_region *P4_io[];
17.14 -char *sh4_main_ram;
17.15 +sh4ptr_t sh4_main_ram;
17.16
17.17 int32_t sh4_read_p4( uint32_t addr )
17.18 {
17.19 @@ -106,7 +106,7 @@
17.20
17.21 int32_t sh4_read_phys_word( uint32_t addr )
17.22 {
17.23 - char *page;
17.24 + sh4ptr_t page;
17.25 if( addr >= 0xE0000000 ) /* P4 Area, handled specially */
17.26 return SIGNEXT16(sh4_read_p4( addr ));
17.27
17.28 @@ -129,7 +129,7 @@
17.29
17.30 int32_t sh4_read_long( uint32_t addr )
17.31 {
17.32 - char *page;
17.33 + sh4ptr_t page;
17.34
17.35 CHECK_READ_WATCH(addr,4);
17.36
17.37 @@ -161,7 +161,7 @@
17.38
17.39 int32_t sh4_read_word( uint32_t addr )
17.40 {
17.41 - char *page;
17.42 + sh4ptr_t page;
17.43
17.44 CHECK_READ_WATCH(addr,2);
17.45
17.46 @@ -193,7 +193,7 @@
17.47
17.48 int32_t sh4_read_byte( uint32_t addr )
17.49 {
17.50 - char *page;
17.51 + sh4ptr_t page;
17.52
17.53 CHECK_READ_WATCH(addr,1);
17.54
17.55 @@ -226,7 +226,7 @@
17.56
17.57 void sh4_write_long( uint32_t addr, uint32_t val )
17.58 {
17.59 - char *page;
17.60 + sh4ptr_t page;
17.61
17.62 // fprintf( stderr, "MOV.L %08X => %08X\n", val, addr );
17.63 CHECK_WRITE_WATCH(addr,4,val);
17.64 @@ -273,7 +273,7 @@
17.65
17.66 void sh4_write_word( uint32_t addr, uint32_t val )
17.67 {
17.68 - char *page;
17.69 + sh4ptr_t page;
17.70
17.71 // fprintf( stderr, "MOV.W %04X => %08X\n", val, addr );
17.72 CHECK_WRITE_WATCH(addr,2,val);
17.73 @@ -314,7 +314,7 @@
17.74
17.75 void sh4_write_byte( uint32_t addr, uint32_t val )
17.76 {
17.77 - char *page;
17.78 + sh4ptr_t page;
17.79
17.80 // fprintf( stderr, "MOV.B %02X => %08X\n", val, addr );
17.81 CHECK_WRITE_WATCH(addr,1,val);
17.82 @@ -358,11 +358,11 @@
17.83 /* FIXME: Handle all the many special cases when the range doesn't fall cleanly
17.84 * into the same memory block
17.85 */
17.86 -void mem_copy_from_sh4( unsigned char *dest, uint32_t srcaddr, size_t count ) {
17.87 +void mem_copy_from_sh4( sh4ptr_t dest, uint32_t srcaddr, size_t count ) {
17.88 if( srcaddr >= 0x04000000 && srcaddr < 0x05000000 ) {
17.89 pvr2_vram64_read( dest, srcaddr, count );
17.90 } else {
17.91 - char *src = mem_get_region(srcaddr);
17.92 + sh4ptr_t src = mem_get_region(srcaddr);
17.93 if( src == NULL ) {
17.94 WARN( "Attempted block read from unknown address %08X", srcaddr );
17.95 } else {
17.96 @@ -371,7 +371,7 @@
17.97 }
17.98 }
17.99
17.100 -void mem_copy_to_sh4( uint32_t destaddr, unsigned char *src, size_t count ) {
17.101 +void mem_copy_to_sh4( uint32_t destaddr, sh4ptr_t src, size_t count ) {
17.102 if( destaddr >= 0x10000000 && destaddr < 0x14000000 ) {
17.103 pvr2_dma_write( destaddr, src, count );
17.104 return;
17.105 @@ -381,7 +381,7 @@
17.106 pvr2_vram64_write( destaddr, src, count );
17.107 return;
17.108 }
17.109 - char *dest = mem_get_region(destaddr);
17.110 + sh4ptr_t dest = mem_get_region(destaddr);
17.111 if( dest == NULL )
17.112 WARN( "Attempted block write to unknown address %08X", destaddr );
17.113 else {
17.114 @@ -394,7 +394,7 @@
17.115 {
17.116 /* Store queue operation */
17.117 int queue = (addr&0x20)>>2;
17.118 - unsigned char *src = (unsigned char *)&sh4r.store_queue[queue];
17.119 + sh4ptr_t src = (sh4ptr_t)&sh4r.store_queue[queue];
17.120 uint32_t hi = (MMIO_READ( MMU, (queue == 0 ? QACR0 : QACR1) ) & 0x1C) << 24;
17.121 uint32_t target = (addr&0x03FFFFE0) | hi;
17.122 mem_copy_to_sh4( target, src, 32 );
18.1 --- a/src/sh4/sh4mmio.c Thu Nov 08 11:53:56 2007 +0000
18.2 +++ b/src/sh4/sh4mmio.c Thu Nov 08 11:54:16 2007 +0000
18.3 @@ -1,5 +1,5 @@
18.4 /**
18.5 - * $Id: sh4mmio.c,v 1.14 2007-10-07 06:27:12 nkeynes Exp $
18.6 + * $Id: sh4mmio.c,v 1.15 2007-11-08 11:54:16 nkeynes Exp $
18.7 *
18.8 * Miscellaneous and not-really-implemented SH4 peripheral modules. Also
18.9 * responsible for including the IMPL side of the SH4 MMIO pages.
18.10 @@ -35,7 +35,7 @@
18.11 #define OCRAM_START (0x1C000000>>PAGE_BITS)
18.12 #define OCRAM_END (0x20000000>>PAGE_BITS)
18.13
18.14 -static char *cache = NULL;
18.15 +static sh4ptr_t cache = NULL;
18.16
18.17 void mmio_region_MMU_write( uint32_t reg, uint32_t val )
18.18 {
19.1 --- a/src/sh4/sh4x86.c Thu Nov 08 11:53:56 2007 +0000
19.2 +++ b/src/sh4/sh4x86.c Thu Nov 08 11:54:16 2007 +0000
19.3 @@ -1,5 +1,5 @@
19.4 /**
19.5 - * $Id: sh4x86.c,v 1.18 2007-10-04 08:47:27 nkeynes Exp $
19.6 + * $Id: sh4x86.c,v 1.19 2007-11-08 11:54:16 nkeynes Exp $
19.7 *
19.8 * SH4 => x86 translation. This version does no real optimization, it just
19.9 * outputs straight-line x86 code - it mainly exists to provide a baseline
19.10 @@ -2825,7 +2825,7 @@
19.11 SLOTILLEGAL();
19.12 } else {
19.13 uint32_t target = (pc & 0xFFFFFFFC) + disp + 4;
19.14 - char *ptr = mem_get_region(target);
19.15 + sh4ptr_t ptr = mem_get_region(target);
19.16 if( ptr != NULL ) {
19.17 MOV_moff32_EAX( (uint32_t)ptr );
19.18 } else {
20.1 --- a/src/sh4/sh4x86.in Thu Nov 08 11:53:56 2007 +0000
20.2 +++ b/src/sh4/sh4x86.in Thu Nov 08 11:54:16 2007 +0000
20.3 @@ -1,5 +1,5 @@
20.4 /**
20.5 - * $Id: sh4x86.in,v 1.19 2007-10-04 08:47:27 nkeynes Exp $
20.6 + * $Id: sh4x86.in,v 1.20 2007-11-08 11:54:16 nkeynes Exp $
20.7 *
20.8 * SH4 => x86 translation. This version does no real optimization, it just
20.9 * outputs straight-line x86 code - it mainly exists to provide a baseline
20.10 @@ -1317,7 +1317,7 @@
20.11 SLOTILLEGAL();
20.12 } else {
20.13 uint32_t target = (pc & 0xFFFFFFFC) + disp + 4;
20.14 - char *ptr = mem_get_region(target);
20.15 + sh4ptr_t ptr = mem_get_region(target);
20.16 if( ptr != NULL ) {
20.17 MOV_moff32_EAX( (uint32_t)ptr );
20.18 } else {
21.1 --- a/src/sh4/xltcache.c Thu Nov 08 11:53:56 2007 +0000
21.2 +++ b/src/sh4/xltcache.c Thu Nov 08 11:54:16 2007 +0000
21.3 @@ -1,5 +1,5 @@
21.4 /**
21.5 - * $Id: xltcache.c,v 1.10 2007-11-04 01:03:00 nkeynes Exp $
21.6 + * $Id: xltcache.c,v 1.11 2007-11-08 11:54:16 nkeynes Exp $
21.7 *
21.8 * Translation cache management. This part is architecture independent.
21.9 *
21.10 @@ -374,7 +374,7 @@
21.11 if( xlat_new_cache_ptr->size == 0 ) {
21.12 /* Migrate to the front of the cache to keep it contiguous */
21.13 xlat_new_create_ptr->active = 0;
21.14 - unsigned char *olddata = xlat_new_create_ptr->code;
21.15 + sh4ptr_t olddata = xlat_new_create_ptr->code;
21.16 int oldsize = xlat_new_create_ptr->size;
21.17 int size = oldsize + MIN_BLOCK_SIZE; /* minimum expansion */
21.18 void **lut_entry = xlat_new_create_ptr->lut_entry;
22.1 --- a/src/util.c Thu Nov 08 11:53:56 2007 +0000
22.2 +++ b/src/util.c Thu Nov 08 11:54:16 2007 +0000
22.3 @@ -1,5 +1,5 @@
22.4 /**
22.5 - * $Id: util.c,v 1.13 2007-11-07 11:45:53 nkeynes Exp $
22.6 + * $Id: util.c,v 1.14 2007-11-08 11:54:16 nkeynes Exp $
22.7 *
22.8 * Miscellaneous utility functions.
22.9 *
22.10 @@ -34,7 +34,7 @@
22.11 #include "sh4/sh4core.h"
22.12
22.13 char *msg_levels[] = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE" };
22.14 -int global_msg_level = EMIT_INFO;
22.15 +int global_msg_level = EMIT_WARN;
22.16
22.17 static void report_crash( int signo, siginfo_t *info, void *ptr )
22.18 {
22.19 @@ -254,7 +254,7 @@
22.20 int rowbytes = png_get_rowbytes(png_ptr, info_ptr);
22.21 int channels = png_get_channels(png_ptr, info_ptr);
22.22 frame_buffer_t buffer = g_malloc( sizeof(struct frame_buffer) + rowbytes*height );
22.23 - buffer->data = (char *)(buffer+1);
22.24 + buffer->data = (unsigned char *)(buffer+1);
22.25 buffer->width = width;
22.26 buffer->height = height;
22.27 buffer->rowstride = rowbytes;
.