Search
lxdream.org :: lxdream/src/sh4/sh4core.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4core.h
changeset 569:a1c49e1e8776
prev564:dc7b5ffb0535
next570:d2893980fbf5
author nkeynes
date Fri Jan 04 11:54:17 2008 +0000 (14 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Bring icache partially into line with the mmu, a little less slow with AT off
now.
file annotate diff log raw
1.1 --- a/src/sh4/sh4core.h Tue Jan 01 08:37:26 2008 +0000
1.2 +++ b/src/sh4/sh4core.h Fri Jan 04 11:54:17 2008 +0000
1.3 @@ -33,6 +33,37 @@
1.4 /* Breakpoint data structure */
1.5 extern struct breakpoint_struct sh4_breakpoints[MAX_BREAKPOINTS];
1.6 extern int sh4_breakpoint_count;
1.7 +extern sh4ptr_t sh4_main_ram;
1.8 +
1.9 +/**
1.10 + * Cached direct pointer to the current instruction page. If AT is on, this
1.11 + * is derived from the ITLB, otherwise this will be the entire memory region.
1.12 + * This is actually a fairly useful optimization, as we can make a lot of
1.13 + * assumptions about the "current page" that we can't make in general for
1.14 + * arbitrary virtual addresses.
1.15 + */
1.16 +struct sh4_icache_struct {
1.17 + sh4ptr_t page; // Page pointer (NULL if no page)
1.18 + sh4vma_t page_vma; // virtual address of the page.
1.19 + sh4addr_t page_ppa; // physical address of the page
1.20 + uint32_t mask; // page mask
1.21 +};
1.22 +extern struct sh4_icache_struct sh4_icache;
1.23 +
1.24 +/**
1.25 + * Test if a given address is contained in the current icache entry
1.26 + */
1.27 +#define IS_IN_ICACHE(addr) (sh4_icache.page_vma == ((addr) & sh4_icache.mask))
1.28 +/**
1.29 + * Return a pointer for the given vma, under the assumption that it is
1.30 + * actually contained in the current icache entry.
1.31 + */
1.32 +#define GET_ICACHE_PTR(addr) (sh4_icache.page + ((addr)-sh4_icache.page_vma))
1.33 +/**
1.34 + * Return the physical (external) address for the given vma, assuming that it is
1.35 + * actually contained in the current icache entry.
1.36 + */
1.37 +#define GET_ICACHE_PHYS(addr) (sh4_icache.page_ppa + ((addr)-sh4_icache.page_vma))
1.38
1.39 /* SH4 module functions */
1.40 void sh4_init( void );
1.41 @@ -74,9 +105,10 @@
1.42 void signsat48(void);
1.43
1.44 /* SH4 Memory */
1.45 -uint64_t mmu_vma_to_phys_read( sh4addr_t addr );
1.46 -uint64_t mmu_vma_to_phys_write( sh4addr_t addr );
1.47 -uint64_t mmu_vma_to_phys_exec( sh4addr_t addr );
1.48 +gboolean mmu_update_icache( sh4vma_t addr );
1.49 +uint64_t mmu_vma_to_phys_read( sh4vma_t addr );
1.50 +uint64_t mmu_vma_to_phys_write( sh4vma_t addr );
1.51 +uint64_t mmu_vma_to_phys_exec( sh4vma_t addr );
1.52
1.53 int64_t sh4_read_quad( sh4addr_t addr );
1.54 int64_t sh4_read_long( sh4addr_t addr );
.