Search
lxdream.org :: lxdream :: r1167:2cc6c50d0dd2
lxdream 0.9.1
released Jun 29
Download Now
changeset1167:2cc6c50d0dd2
parent1166:f405d42a9786
child1168:66e5113d4155
authornkeynes
dateMon Feb 14 08:12:41 2011 +1000 (8 years ago)
Add default read/write burst methods for IO regions. (There's almost
certainly a bug somewhere if these are actually invoked, but try to do the
right thing anyway rather than crashing)
src/mem.c
1.1 --- a/src/mem.c Fri Jan 28 16:14:57 2011 +1000
1.2 +++ b/src/mem.c Mon Feb 14 08:12:41 2011 +1000
1.3 @@ -83,6 +83,30 @@
1.4 /* No effect */
1.5 }
1.6
1.7 +void FASTCALL default_write_burst( sh4addr_t addr, unsigned char *src )
1.8 +{
1.9 + mem_write_fn_t writefn = ext_address_space[(addr&0x1FFFFFFF)>>12]->write_long;
1.10 + uint32_t *p = (uint32_t *)src;
1.11 + sh4addr_t end = addr + 32;
1.12 + while( addr < end ) {
1.13 + writefn(addr, *p);
1.14 + addr += 4;
1.15 + p += 4;
1.16 + }
1.17 +}
1.18 +
1.19 +void FASTCALL default_read_burst( unsigned char *dest, sh4addr_t addr )
1.20 +{
1.21 + mem_read_fn_t readfn = ext_address_space[(addr&0x1FFFFFFF)>>12]->read_long;
1.22 + uint32_t *p = (uint32_t *)dest;
1.23 + sh4addr_t end = addr + 32;
1.24 + while( addr < end ) {
1.25 + *p = readfn(addr);
1.26 + addr += 4;
1.27 + p += 4;
1.28 + }
1.29 +}
1.30 +
1.31 struct mem_region_fn mem_region_unmapped = {
1.32 unmapped_read_long, unmapped_write_long,
1.33 unmapped_read_long, unmapped_write_long,
1.34 @@ -400,6 +424,10 @@
1.35 io->save_mem = io->mem + LXDREAM_PAGE_SIZE;
1.36 io->index = (struct mmio_port **)malloc(1024*sizeof(struct mmio_port *));
1.37 io->trace_flag = 0;
1.38 + if( io->fn.write_burst == NULL )
1.39 + io->fn.write_burst = default_write_burst;
1.40 + if( io->fn.read_burst == NULL )
1.41 + io->fn.read_burst = default_read_burst;
1.42 memset( io->index, 0, 1024*sizeof(struct mmio_port *) );
1.43 for( i=0; io->ports[i].id != NULL; i++ ) {
1.44 io->ports[i].val = (uint32_t *)(io->mem + io->ports[i].offset);
.