Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 510:41ce7a074f4e
prev502:c4ecae2b1b5e
next543:361ec0a70cf2
author nkeynes
date Wed Nov 14 10:21:33 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Use an explicit 32-bit type for region flags (save-file compatibility)
Ensure page map is fully cleared
file annotate diff log raw
1.1 --- a/src/mem.c Thu Nov 08 11:54:16 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 */
.