Search
lxdream.org :: lxdream :: r945:787729653236
lxdream 0.9.1
released Jun 29
Download Now
changeset945:787729653236 lxdream-mem
parent944:a4e31314bee1
child946:d41ee7994db7
authornkeynes
dateMon Jan 05 04:19:46 2009 +0000 (11 years ago)
branchlxdream-mem
Move address space decls to mmu.h
Finally remove sh4_read_long and friends
src/sh4/mmu.h
src/sh4/sh4core.h
src/sh4/sh4core.in
src/sh4/sh4mem.c
src/sh4/sh4stat.in
src/test/testsh4x86.c
1.1 --- a/src/sh4/mmu.h Mon Jan 05 04:17:20 2009 +0000
1.2 +++ b/src/sh4/mmu.h Mon Jan 05 04:19:46 2009 +0000
1.3 @@ -105,7 +105,22 @@
1.4
1.5 extern uint32_t mmu_urc;
1.6 extern uint32_t mmu_urb;
1.7 -
1.8 +
1.9 +/** Primary SH4 address space (privileged and user access)
1.10 + * Page map (4KB) of the entire 32-bit address space
1.11 + * Note: only callable from the SH4 cores as it depends on the caller setting
1.12 + * up an appropriate exception environment.
1.13 + **/
1.14 +extern struct mem_region_fn **sh4_address_space;
1.15 +extern struct mem_region_fn **sh4_user_address_space;
1.16 +
1.17 +/** Store-queue (prefetch) address space (privileged and user access)
1.18 + * Page map (4KB) of the 0xE0000000..0xE4000000 region
1.19 + * Same caveats apply as for the primary address space above.
1.20 + */
1.21 +extern struct mem_region_fn **storequeue_address_space;
1.22 +extern struct mem_region_fn **storequeue_user_address_space;
1.23 +
1.24 #ifdef __cplusplus
1.25 }
1.26 #endif
2.1 --- a/src/sh4/sh4core.h Mon Jan 05 04:17:20 2009 +0000
2.2 +++ b/src/sh4/sh4core.h Mon Jan 05 04:19:46 2009 +0000
2.3 @@ -1,10 +1,9 @@
2.4 /**
2.5 * $Id$
2.6 *
2.7 - * This file defines the internal functions exported/used by the SH4 core,
2.8 - * except for disassembly functions defined in sh4dasm.h
2.9 + * This file defines the internal functions used by the SH4 core,
2.10 *
2.11 - * Copyright (c) 2005 Nathan Keynes.
2.12 + * Copyright (c) 2005-2008 Nathan Keynes.
2.13 *
2.14 * This program is free software; you can redistribute it and/or modify
2.15 * it under the terms of the GNU General Public License as published by
2.16 @@ -50,11 +49,6 @@
2.17 };
2.18 extern struct sh4_icache_struct sh4_icache;
2.19
2.20 -extern struct mem_region_fn **sh4_address_space;
2.21 -extern struct mem_region_fn **sh4_user_address_space;
2.22 -extern struct mem_region_fn **storequeue_address_space;
2.23 -extern struct mem_region_fn **storequeue_user_address_space;
2.24 -
2.25 /**
2.26 * Test if a given address is contained in the current icache entry
2.27 */
2.28 @@ -205,22 +199,6 @@
2.29 */
2.30 gboolean FASTCALL mmu_update_icache( sh4vma_t addr );
2.31
2.32 -/**
2.33 - * Resolve a virtual address through the TLB for a read operation, returning
2.34 - * the resultant P4 or external address. If the resolution fails, the
2.35 - * appropriate MMU exception is raised and the value MMU_VMA_ERROR is returned.
2.36 - * @return An external address (0x00000000-0x1FFFFFFF), a P4 address
2.37 - * (0xE0000000 - 0xFFFFFFFF), or MMU_VMA_ERROR.
2.38 - */
2.39 -#ifdef HAVE_FRAME_ADDRESS
2.40 -sh4addr_t FASTCALL mmu_vma_to_phys_read( sh4vma_t addr, void *exc );
2.41 -sh4addr_t FASTCALL mmu_vma_to_phys_write( sh4vma_t addr, void *exc );
2.42 -#else
2.43 -sh4addr_t FASTCALL mmu_vma_to_phys_read( sh4vma_t addr );
2.44 -sh4addr_t FASTCALL mmu_vma_to_phys_write( sh4vma_t addr );
2.45 -#endif
2.46 -sh4addr_t FASTCALL mmu_vma_to_phys_disasm( sh4vma_t addr );
2.47 -
2.48 int64_t FASTCALL sh4_read_quad( sh4addr_t addr );
2.49 int32_t FASTCALL sh4_read_long( sh4addr_t addr );
2.50 int32_t FASTCALL sh4_read_word( sh4addr_t addr );
3.1 --- a/src/sh4/sh4core.in Mon Jan 05 04:17:20 2009 +0000
3.2 +++ b/src/sh4/sh4core.in Mon Jan 05 04:19:46 2009 +0000
3.3 @@ -29,7 +29,7 @@
3.4 #include "sh4/sh4core.h"
3.5 #include "sh4/sh4mmio.h"
3.6 #include "sh4/sh4stat.h"
3.7 -#include "sh4/intc.h"
3.8 +#include "sh4/mmu.h"
3.9
3.10 #define SH4_CALLTRACE 1
3.11
4.1 --- a/src/sh4/sh4mem.c Mon Jan 05 04:17:20 2009 +0000
4.2 +++ b/src/sh4/sh4mem.c Mon Jan 05 04:19:46 2009 +0000
4.3 @@ -28,40 +28,11 @@
4.4 #include "sh4/sh4core.h"
4.5 #include "sh4/sh4mmio.h"
4.6 #include "sh4/xltcache.h"
4.7 +#include "sh4/mmu.h"
4.8 #include "pvr2/pvr2.h"
4.9
4.10 /************** Obsolete methods ***************/
4.11
4.12 -int32_t FASTCALL sh4_read_long( sh4addr_t addr )
4.13 -{
4.14 - return sh4_address_space[addr>>12]->read_long(addr);
4.15 -}
4.16 -
4.17 -int32_t FASTCALL sh4_read_word( sh4addr_t addr )
4.18 -{
4.19 - return sh4_address_space[addr>>12]->read_word(addr);
4.20 -}
4.21 -
4.22 -int32_t FASTCALL sh4_read_byte( sh4addr_t addr )
4.23 -{
4.24 - return sh4_address_space[addr>>12]->read_byte(addr);
4.25 -}
4.26 -
4.27 -void FASTCALL sh4_write_long( sh4addr_t addr, uint32_t val )
4.28 -{
4.29 - sh4_address_space[addr>>12]->write_long(addr, val);
4.30 -}
4.31 -
4.32 -void FASTCALL sh4_write_word( sh4addr_t addr, uint32_t val )
4.33 -{
4.34 - sh4_address_space[addr>>12]->write_word(addr,val);
4.35 -}
4.36 -
4.37 -void FASTCALL sh4_write_byte( sh4addr_t addr, uint32_t val )
4.38 -{
4.39 - sh4_address_space[addr>>12]->write_byte(addr, val);
4.40 -}
4.41 -
4.42 /* FIXME: Handle all the many special cases when the range doesn't fall cleanly
4.43 * into the same memory block
4.44 */
5.1 --- a/src/sh4/sh4stat.in Mon Jan 05 04:17:20 2009 +0000
5.2 +++ b/src/sh4/sh4stat.in Mon Jan 05 04:19:46 2009 +0000
5.3 @@ -19,6 +19,7 @@
5.4 #include "dream.h"
5.5 #include "sh4/sh4stat.h"
5.6 #include "sh4/sh4core.h"
5.7 +#include "sh4/mmu.h"
5.8
5.9 static uint64_t sh4_stats[SH4_INSTRUCTION_COUNT+1];
5.10 static uint64_t sh4_stats_total;
5.11 @@ -194,7 +195,8 @@
5.12
5.13 void sh4_stats_add_by_pc( uint32_t pc )
5.14 {
5.15 - uint16_t ir = sh4_read_word(pc);
5.16 + sh4addr_t addr = mmu_vma_to_phys_disasm(pc);
5.17 + uint16_t ir = ext_address_space[addr>>12]->read_word(addr);
5.18 #define UNDEF(ir) sh4_stats[0]++
5.19 %%
5.20 ADD Rm, Rn {: sh4_stats[I_ADD]++; :}
6.1 --- a/src/test/testsh4x86.c Mon Jan 05 04:17:20 2009 +0000
6.2 +++ b/src/test/testsh4x86.c Mon Jan 05 04:19:46 2009 +0000
6.3 @@ -37,6 +37,7 @@
6.4
6.5
6.6 struct mem_region_fn **sh4_address_space = (void *)0x12345432;
6.7 +struct mem_region_fn **sh4_user_address_space = (void *)0x12345678;
6.8 char *option_list = "s:o:d:h";
6.9 struct option longopts[1] = { { NULL, 0, 0, 0 } };
6.10
6.11 @@ -55,7 +56,8 @@
6.12 struct x86_symbol local_symbols[] = {
6.13 { "sh4r+128", ((char *)&sh4r)+128 },
6.14 { "sh4_cpu_period", &sh4_cpu_period },
6.15 - { "sh4_address_space", 0x12345432 },
6.16 + { "sh4_address_space", (void *)0x12345432 },
6.17 + { "sh4_user_address_space", (void *)0x12345678 },
6.18 { "sh4_write_fpscr", sh4_write_fpscr },
6.19 { "sh4_write_sr", sh4_write_sr },
6.20 { "sh4_read_sr", sh4_read_sr },
6.21 @@ -65,29 +67,10 @@
6.22 { "sh4_switch_fr_banks", sh4_switch_fr_banks },
6.23 { "sh4_execute_instruction", sh4_execute_instruction },
6.24 { "signsat48", signsat48 },
6.25 - { "sh4_read_byte", sh4_read_byte },
6.26 - { "sh4_read_word", sh4_read_word },
6.27 - { "sh4_read_long", sh4_read_long },
6.28 - { "sh4_write_byte", sh4_write_byte },
6.29 - { "sh4_write_word", sh4_write_word },
6.30 - { "sh4_write_long", sh4_write_long },
6.31 { "xlat_get_code_by_vma", xlat_get_code_by_vma },
6.32 { "xlat_get_code", xlat_get_code }
6.33 };
6.34
6.35 -int32_t FASTCALL sh4_read_byte( uint32_t addr )
6.36 -{
6.37 - return *(uint8_t *)(inbuf+(addr-start_addr));
6.38 -}
6.39 -int32_t FASTCALL sh4_read_word( uint32_t addr )
6.40 -{
6.41 - return *(uint16_t *)(inbuf+(addr-start_addr));
6.42 -}
6.43 -int32_t FASTCALL sh4_read_long( uint32_t addr )
6.44 -{
6.45 - return *(uint32_t *)(inbuf+(addr-start_addr));
6.46 -}
6.47 -
6.48 // Stubs
6.49 gboolean sh4_execute_instruction( ) { return TRUE; }
6.50 void sh4_accept_interrupt() {}
6.51 @@ -102,9 +85,6 @@
6.52 void CCN_set_cache_control( uint32_t val ) { }
6.53 void PMM_write_control( int ctr, uint32_t val ) { }
6.54 void SCIF_run_slice( uint32_t nanos ) {}
6.55 -void FASTCALL sh4_write_byte( uint32_t addr, uint32_t val ) {}
6.56 -void FASTCALL sh4_write_word( uint32_t addr, uint32_t val ) {}
6.57 -void FASTCALL sh4_write_long( uint32_t addr, uint32_t val ) {}
6.58 void FASTCALL sh4_write_fpscr( uint32_t val ) { }
6.59 void FASTCALL sh4_write_sr( uint32_t val ) { }
6.60 uint32_t FASTCALL sh4_read_sr( void ) { return 0; }
.