Search
lxdream.org :: lxdream/src/mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/mem.c
changeset 796:a2dc83592467
prev743:6f0f79fae449
next825:2ac7ceccd775
author nkeynes
date Wed Jul 30 22:50:44 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Bug #61: OpenBSD support
(Modified) patch from bsdmaniak, thanks!
file annotate diff log raw
1.1 --- a/src/mem.c Fri Jul 18 11:08:30 2008 +0000
1.2 +++ b/src/mem.c Wed Jul 30 22:50:44 2008 +0000
1.3 @@ -62,7 +62,7 @@
1.4
1.5 void mem_init( void )
1.6 {
1.7 - page_map = mmap( NULL, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES,
1.8 + page_map = mmap( NULL, sizeof(sh4ptr_t) * LXDREAM_PAGE_TABLE_ENTRIES,
1.9 PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0 );
1.10 if( page_map == MAP_FAILED ) {
1.11 ERROR( "Unable to allocate page map! (%s)", strerror(errno) );
1.12 @@ -70,7 +70,7 @@
1.13 return;
1.14 }
1.15
1.16 - memset( page_map, 0, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES );
1.17 + memset( page_map, 0, sizeof(sh4ptr_t) * LXDREAM_PAGE_TABLE_ENTRIES );
1.18 }
1.19
1.20 void mem_reset( void )
1.21 @@ -237,8 +237,8 @@
1.22 num_mem_rgns++;
1.23
1.24 do {
1.25 - for( i=0; i<size>>PAGE_BITS; i++ )
1.26 - page_map[(base>>PAGE_BITS)+i] = mem + (i<<PAGE_BITS);
1.27 + for( i=0; i<size>>LXDREAM_PAGE_BITS; i++ )
1.28 + page_map[(base>>LXDREAM_PAGE_BITS)+i] = mem + (i<<LXDREAM_PAGE_BITS);
1.29 base += repeat_offset;
1.30 } while( base <= repeat_until );
1.31
1.32 @@ -260,7 +260,7 @@
1.33 assert( num_mem_rgns < MAX_MEM_REGIONS );
1.34 assert( page_map != NULL );
1.35
1.36 - mem = mem_alloc_pages( size>>PAGE_BITS );
1.37 + mem = mem_alloc_pages( size>>LXDREAM_PAGE_BITS );
1.38
1.39 mem_map_region( mem, base, size, name, MEM_FLAG_RAM, repeat_offset, repeat_until );
1.40
1.41 @@ -318,7 +318,7 @@
1.42
1.43 assert(io);
1.44 io->mem = mem_alloc_pages(2);
1.45 - io->save_mem = io->mem + PAGE_SIZE;
1.46 + io->save_mem = io->mem + LXDREAM_PAGE_SIZE;
1.47 io->index = (struct mmio_port **)malloc(1024*sizeof(struct mmio_port *));
1.48 io->trace_flag = 0;
1.49 memset( io->index, 0, 1024*sizeof(struct mmio_port *) );
1.50 @@ -327,7 +327,7 @@
1.51 *io->ports[i].val = io->ports[i].def_val;
1.52 io->index[io->ports[i].offset>>2] = &io->ports[i];
1.53 }
1.54 - memcpy( io->save_mem, io->mem, PAGE_SIZE );
1.55 + memcpy( io->save_mem, io->mem, LXDREAM_PAGE_SIZE );
1.56 if( (io->base & 0xFF000000) == 0xFF000000 ) {
1.57 /* P4 area (on-chip I/O channels */
1.58 P4_io[(io->base&0x1FFFFFFF)>>19] = io;
.