Search
lxdream.org :: lxdream/src/sh4/mmu.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/mmu.h
changeset 939:6f2302afeb89
prev931:430048ea8b71
next945:787729653236
author nkeynes
date Sat Jan 03 03:30:26 2009 +0000 (12 years ago)
branchlxdream-mem
permissions -rw-r--r--
last change MMU work-in-progress
* Move SDRAM out into separate sdram.c
* Move all page-table management into mmu.c
* Convert UTLB management to use the new page-tables
* Rip out all calls to mmu_vma_to_phys_* and replace with direct access
file annotate diff log raw
1.1 --- a/src/sh4/mmu.h Tue Dec 23 05:48:05 2008 +0000
1.2 +++ b/src/sh4/mmu.h Sat Jan 03 03:30:26 2009 +0000
1.3 @@ -29,6 +29,20 @@
1.4 #define VMA_TO_EXT_ADDR(vma) ((vma)&0x1FFFFFFF)
1.5
1.6 /************************** UTLB/ITLB Definitions ***************************/
1.7 +/* mmucr register bits */
1.8 +#define MMUCR_AT 0x00000001 /* Address Translation enabled */
1.9 +#define MMUCR_TI 0x00000004 /* TLB invalidate (always read as 0) */
1.10 +#define MMUCR_SV 0x00000100 /* Single Virtual mode=1 / multiple virtual=0 */
1.11 +#define MMUCR_SQMD 0x00000200 /* Store queue mode bit (0=user, 1=priv only) */
1.12 +#define MMUCR_URC 0x0000FC00 /* UTLB access counter */
1.13 +#define MMUCR_URB 0x00FC0000 /* UTLB entry boundary */
1.14 +#define MMUCR_LRUI 0xFC000000 /* Least recently used ITLB */
1.15 +#define MMUCR_MASK 0xFCFCFF05
1.16 +#define MMUCR_RMASK 0xFCFCFF01 /* Read mask */
1.17 +
1.18 +#define IS_TLB_ENABLED() (MMIO_READ(MMU, MMUCR)&MMUCR_AT)
1.19 +#define IS_SV_ENABLED() (MMIO_READ(MMU,MMUCR)&MMUCR_SV)
1.20 +
1.21 #define ITLB_ENTRY_COUNT 4
1.22 #define UTLB_ENTRY_COUNT 64
1.23
1.24 @@ -66,14 +80,31 @@
1.25 uint32_t asid; // Process ID
1.26 sh4addr_t ppn; // Physical Page Number
1.27 uint32_t flags;
1.28 - uint32_t pcmcia; // extra pcmcia data - not used
1.29 + uint32_t pcmcia; // extra pcmcia data - not used in this implementation
1.30 };
1.31
1.32 -struct utlb_sort_entry {
1.33 - sh4addr_t key; // Masked VPN + ASID
1.34 - uint32_t mask; // Mask + 0x00FF
1.35 - int entryNo;
1.36 +#define TLB_FUNC_SIZE 48
1.37 +
1.38 +struct utlb_page_entry {
1.39 + struct mem_region_fn fn;
1.40 + mem_region_fn_t user_fn;
1.41 + mem_region_fn_t target;
1.42 + unsigned char code[TLB_FUNC_SIZE*8];
1.43 };
1.44 +
1.45 +struct utlb_1k_entry {
1.46 + struct mem_region_fn fn;
1.47 + struct mem_region_fn user_fn;
1.48 + struct mem_region_fn *subpages[4];
1.49 + struct mem_region_fn *user_subpages[4];
1.50 + unsigned char code[TLB_FUNC_SIZE*16];
1.51 +};
1.52 +
1.53 +void mmu_utlb_init_vtable( struct utlb_entry *ent, struct utlb_page_entry *page, gboolean writable );
1.54 +void mmu_utlb_1k_init_vtable( struct utlb_1k_entry *ent );
1.55 +
1.56 +extern uint32_t mmu_urc;
1.57 +extern uint32_t mmu_urb;
1.58
1.59 #ifdef __cplusplus
1.60 }
.