Search
lxdream.org :: lxdream :: r510:41ce7a074f4e
lxdream 0.9.1
released Jun 29
Download Now
changeset510:41ce7a074f4e
parent509:d72564edc482
child511:e02fb1af6fff
authornkeynes
dateWed Nov 14 10:21:33 2007 +0000 (13 years ago)
Use an explicit 32-bit type for region flags (save-file compatibility)
Ensure page map is fully cleared
src/mem.c
src/mem.h
1.1 --- a/src/mem.c Wed Nov 14 10:18:21 2007 +0000
1.2 +++ b/src/mem.c Wed Nov 14 10:21:33 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: mem.c,v 1.22 2007-11-08 11:54:16 nkeynes Exp $
1.6 + * $Id: mem.c,v 1.23 2007-11-14 10:21:33 nkeynes Exp $
1.7 * mem.c is responsible for creating and maintaining the overall system memory
1.8 * map, as visible from the SH4 processor.
1.9 *
1.10 @@ -61,7 +61,7 @@
1.11
1.12 void mem_init( void )
1.13 {
1.14 - page_map = mmap( NULL, sizeof(char *) * PAGE_TABLE_ENTRIES,
1.15 + page_map = mmap( NULL, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES,
1.16 PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0 );
1.17 if( page_map == MAP_FAILED ) {
1.18 ERROR( "Unable to allocate page map! (%s)", strerror(errno) );
1.19 @@ -69,7 +69,7 @@
1.20 return;
1.21 }
1.22
1.23 - memset( page_map, 0, sizeof(uint32_t) * PAGE_TABLE_ENTRIES );
1.24 + memset( page_map, 0, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES );
1.25 }
1.26
1.27 void mem_reset( void )
1.28 @@ -97,7 +97,7 @@
1.29 for( i=0; i<num_mem_rgns; i++ ) {
1.30 fwrite_string( mem_rgn[i].name, f );
1.31 fwrite( &mem_rgn[i].base, sizeof(uint32_t), 1, f );
1.32 - fwrite( &mem_rgn[i].flags, sizeof(int), 1, f );
1.33 + fwrite( &mem_rgn[i].flags, sizeof(uint32_t), 1, f );
1.34 fwrite( &mem_rgn[i].size, sizeof(uint32_t), 1, f );
1.35 if( mem_rgn[i].flags != MEM_FLAG_ROM )
1.36 fwrite_gzip( mem_rgn[i].mem, mem_rgn[i].size, 1, f );
1.37 @@ -119,7 +119,7 @@
1.38 char tmp[64];
1.39 uint32_t len;
1.40 uint32_t base, size;
1.41 - int flags;
1.42 + uint32_t flags;
1.43 int i;
1.44
1.45 /* All memory regions */
2.1 --- a/src/mem.h Wed Nov 14 10:18:21 2007 +0000
2.2 +++ b/src/mem.h Wed Nov 14 10:21:33 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: mem.h,v 1.16 2007-11-08 11:54:16 nkeynes Exp $
2.6 + * $Id: mem.h,v 1.17 2007-11-14 10:21:33 nkeynes Exp $
2.7 *
2.8 * mem is responsible for creating and maintaining the overall system memory
2.9 * map, as visible from the SH4 processor. (Note the ARM has a different map)
2.10 @@ -32,7 +32,7 @@
2.11 uint32_t size;
2.12 const char *name;
2.13 sh4ptr_t mem;
2.14 - int flags;
2.15 + uint32_t flags;
2.16 } *mem_region_t;
2.17
2.18 #define MAX_IO_REGIONS 24
.