Search
lxdream.org :: lxdream :: r796:a2dc83592467
lxdream 0.9.1
released Jun 29
Download Now
changeset796:a2dc83592467
parent795:d347c51dce99
child797:3bb52a384b64
authornkeynes
dateWed Jul 30 22:50:44 2008 +0000 (11 years ago)
Bug #61: OpenBSD support
(Modified) patch from bsdmaniak, thanks!
src/gdrom/gdimage.c
src/gtkui/gtk_mmio.c
src/mem.c
src/mmio.h
src/pvr2/pvr2mem.c
src/sh4/mmu.c
1.1 --- a/src/gdrom/gdimage.c Wed Jul 30 03:00:40 2008 +0000
1.2 +++ b/src/gdrom/gdimage.c Wed Jul 30 22:50:44 2008 +0000
1.3 @@ -19,6 +19,7 @@
1.4 #include <assert.h>
1.5 #include <stdlib.h>
1.6 #include <string.h>
1.7 +#include <sys/types.h>
1.8 #include <netinet/in.h>
1.9
1.10 #include "gdrom/gddriver.h"
2.1 --- a/src/gtkui/gtk_mmio.c Wed Jul 30 03:00:40 2008 +0000
2.2 +++ b/src/gtkui/gtk_mmio.c Wed Jul 30 22:50:44 2008 +0000
2.3 @@ -229,7 +229,7 @@
2.4 }
2.5 count++;
2.6 }
2.7 - memcpy( io_rgn[i]->save_mem, io_rgn[i]->mem, PAGE_SIZE );
2.8 + memcpy( io_rgn[i]->save_mem, io_rgn[i]->mem, LXDREAM_PAGE_SIZE );
2.9 }
2.10 }
2.11
3.1 --- a/src/mem.c Wed Jul 30 03:00:40 2008 +0000
3.2 +++ b/src/mem.c Wed Jul 30 22:50:44 2008 +0000
3.3 @@ -62,7 +62,7 @@
3.4
3.5 void mem_init( void )
3.6 {
3.7 - page_map = mmap( NULL, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES,
3.8 + page_map = mmap( NULL, sizeof(sh4ptr_t) * LXDREAM_PAGE_TABLE_ENTRIES,
3.9 PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0 );
3.10 if( page_map == MAP_FAILED ) {
3.11 ERROR( "Unable to allocate page map! (%s)", strerror(errno) );
3.12 @@ -70,7 +70,7 @@
3.13 return;
3.14 }
3.15
3.16 - memset( page_map, 0, sizeof(sh4ptr_t) * PAGE_TABLE_ENTRIES );
3.17 + memset( page_map, 0, sizeof(sh4ptr_t) * LXDREAM_PAGE_TABLE_ENTRIES );
3.18 }
3.19
3.20 void mem_reset( void )
3.21 @@ -237,8 +237,8 @@
3.22 num_mem_rgns++;
3.23
3.24 do {
3.25 - for( i=0; i<size>>PAGE_BITS; i++ )
3.26 - page_map[(base>>PAGE_BITS)+i] = mem + (i<<PAGE_BITS);
3.27 + for( i=0; i<size>>LXDREAM_PAGE_BITS; i++ )
3.28 + page_map[(base>>LXDREAM_PAGE_BITS)+i] = mem + (i<<LXDREAM_PAGE_BITS);
3.29 base += repeat_offset;
3.30 } while( base <= repeat_until );
3.31
3.32 @@ -260,7 +260,7 @@
3.33 assert( num_mem_rgns < MAX_MEM_REGIONS );
3.34 assert( page_map != NULL );
3.35
3.36 - mem = mem_alloc_pages( size>>PAGE_BITS );
3.37 + mem = mem_alloc_pages( size>>LXDREAM_PAGE_BITS );
3.38
3.39 mem_map_region( mem, base, size, name, MEM_FLAG_RAM, repeat_offset, repeat_until );
3.40
3.41 @@ -318,7 +318,7 @@
3.42
3.43 assert(io);
3.44 io->mem = mem_alloc_pages(2);
3.45 - io->save_mem = io->mem + PAGE_SIZE;
3.46 + io->save_mem = io->mem + LXDREAM_PAGE_SIZE;
3.47 io->index = (struct mmio_port **)malloc(1024*sizeof(struct mmio_port *));
3.48 io->trace_flag = 0;
3.49 memset( io->index, 0, 1024*sizeof(struct mmio_port *) );
3.50 @@ -327,7 +327,7 @@
3.51 *io->ports[i].val = io->ports[i].def_val;
3.52 io->index[io->ports[i].offset>>2] = &io->ports[i];
3.53 }
3.54 - memcpy( io->save_mem, io->mem, PAGE_SIZE );
3.55 + memcpy( io->save_mem, io->mem, LXDREAM_PAGE_SIZE );
3.56 if( (io->base & 0xFF000000) == 0xFF000000 ) {
3.57 /* P4 area (on-chip I/O channels */
3.58 P4_io[(io->base&0x1FFFFFFF)>>19] = io;
4.1 --- a/src/mmio.h Wed Jul 30 03:00:40 2008 +0000
4.2 +++ b/src/mmio.h Wed Jul 30 22:50:44 2008 +0000
4.3 @@ -29,9 +29,9 @@
4.4 #include <stdint.h>
4.5 #include <stdlib.h>
4.6
4.7 -#define PAGE_TABLE_ENTRIES 128*1024
4.8 -#define PAGE_SIZE 4096
4.9 -#define PAGE_BITS 12
4.10 +#define LXDREAM_PAGE_TABLE_ENTRIES 128*1024
4.11 +#define LXDREAM_PAGE_SIZE 4096
4.12 +#define LXDREAM_PAGE_BITS 12
4.13
4.14 #define PORT_R 1
4.15 #define PORT_W 2
5.1 --- a/src/pvr2/pvr2mem.c Wed Jul 30 03:00:40 2008 +0000
5.2 +++ b/src/pvr2/pvr2mem.c Wed Jul 30 22:50:44 2008 +0000
5.3 @@ -71,7 +71,7 @@
5.4 length = 0x800000 - destaddr;
5.5 }
5.6
5.7 - for( i=destaddr & 0xFFFFF000; i < destaddr + length; i+= PAGE_SIZE ) {
5.8 + for( i=destaddr & 0xFFFFF000; i < destaddr + length; i+= LXDREAM_PAGE_SIZE ) {
5.9 texcache_invalidate_page( i );
5.10 }
5.11
5.12 @@ -127,7 +127,7 @@
5.13 line_gap = i >> 3;
5.14 line_bytes >>= 2;
5.15
5.16 - for( i=destaddr & 0xFFFFF000; i < destaddr + line_stride_bytes*line_count; i+= PAGE_SIZE ) {
5.17 + for( i=destaddr & 0xFFFFF000; i < destaddr + line_stride_bytes*line_count; i+= LXDREAM_PAGE_SIZE ) {
5.18 texcache_invalidate_page( i );
5.19 }
5.20
6.1 --- a/src/sh4/mmu.c Wed Jul 30 03:00:40 2008 +0000
6.2 +++ b/src/sh4/mmu.c Wed Jul 30 22:50:44 2008 +0000
6.3 @@ -58,8 +58,8 @@
6.4 MMIO_WRITE(MMU, PTEH, ((MMIO_READ(MMU, PTEH) & 0x000003FF) | (vpn&0xFFFFFC00)));
6.5
6.6
6.7 -#define OCRAM_START (0x1C000000>>PAGE_BITS)
6.8 -#define OCRAM_END (0x20000000>>PAGE_BITS)
6.9 +#define OCRAM_START (0x1C000000>>LXDREAM_PAGE_BITS)
6.10 +#define OCRAM_END (0x20000000>>LXDREAM_PAGE_BITS)
6.11
6.12 #define ITLB_ENTRY_COUNT 4
6.13 #define UTLB_ENTRY_COUNT 64
6.14 @@ -236,11 +236,11 @@
6.15 switch( mode ) {
6.16 case MEM_OC_INDEX0: /* OIX=0 */
6.17 for( i=OCRAM_START; i<OCRAM_END; i++ )
6.18 - page_map[i] = cache + ((i&0x02)<<(PAGE_BITS-1));
6.19 + page_map[i] = cache + ((i&0x02)<<(LXDREAM_PAGE_BITS-1));
6.20 break;
6.21 case MEM_OC_INDEX1: /* OIX=1 */
6.22 for( i=OCRAM_START; i<OCRAM_END; i++ )
6.23 - page_map[i] = cache + ((i&0x02000000)>>(25-PAGE_BITS));
6.24 + page_map[i] = cache + ((i&0x02000000)>>(25-LXDREAM_PAGE_BITS));
6.25 break;
6.26 default: /* disabled */
6.27 for( i=OCRAM_START; i<OCRAM_END; i++ )
.