Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 586:2a3ba82cf243
prev543:361ec0a70cf2
next669:ab344e42bca9
author nkeynes
date Tue Jan 15 20:50:23 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Merged lxdream-mmu r570:596 to trunk
file annotate diff log raw
1.1 --- a/src/mem.c Thu Nov 22 11:10:15 2007 +0000
1.2 +++ b/src/mem.c Tue Jan 15 20:50:23 2008 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: mem.c,v 1.23 2007-11-14 10:21:33 nkeynes Exp $
1.6 + * $Id$
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 @@ -20,6 +20,7 @@
1.11 #include <sys/types.h>
1.12 #include <sys/mman.h>
1.13 #include <sys/stat.h>
1.14 +#include <glib/gstrfuncs.h>
1.15 #include <assert.h>
1.16 #include <stdint.h>
1.17 #include <stdlib.h>
1.18 @@ -280,7 +281,7 @@
1.19 ERROR( "Unable to allocate ROM memory: %s (%s)", file, strerror(errno) );
1.20 return FALSE;
1.21 }
1.22 - mem_map_region( mem, base, size, file, MEM_FLAG_ROM, size, base );
1.23 + mem_map_region( mem, base, size, region_name, MEM_FLAG_ROM, size, base );
1.24 } else {
1.25 mprotect( mem, size, PROT_READ|PROT_WRITE );
1.26 }
1.27 @@ -377,10 +378,39 @@
1.28 }
1.29 }
1.30
1.31 -void mem_set_trace( uint32_t addr, int flag )
1.32 +struct mmio_region *mem_get_io_region_by_name( const gchar *name )
1.33 {
1.34 - struct mmio_region *region = mem_get_io_region(addr);
1.35 - if( region != NULL )
1.36 - region->trace_flag = flag;
1.37 + int i;
1.38 + for( i=0; i<num_io_rgns; i++ ) {
1.39 + if( strcasecmp(io_rgn[i]->id, name) == 0 ) {
1.40 + return io_rgn[i];
1.41 + }
1.42 + }
1.43 + return NULL;
1.44 }
1.45
1.46 +void mem_set_trace( const gchar *tracelist, gboolean flag )
1.47 +{
1.48 + if( tracelist != NULL ) {
1.49 + gchar ** tracev = g_strsplit_set( tracelist, ",:; \t\r\n", 0 );
1.50 + int i;
1.51 + for( i=0; tracev[i] != NULL; i++ ) {
1.52 + // Special case "all" - trace everything
1.53 + if( strcasecmp(tracev[i], "all") == 0 ) {
1.54 + int j;
1.55 + for( j=0; j<num_io_rgns; j++ ) {
1.56 + io_rgn[j]->trace_flag = flag ? 1 : 0;
1.57 + }
1.58 + break;
1.59 + }
1.60 + struct mmio_region *region = mem_get_io_region_by_name( tracev[i] );
1.61 + if( region == NULL ) {
1.62 + WARN( "Unknown IO region '%s'", tracev[i] );
1.63 + } else {
1.64 + region->trace_flag = flag ? 1 : 0;
1.65 + }
1.66 + }
1.67 + g_strfreev( tracev );
1.68 + }
1.69 +}
1.70 +
.