47 #include <sys/cdefs.h>
88 #define MMU_TOP_SHIFT 21
89 #define MMU_TOP_BITS 10
90 #define MMU_TOP_MASK ((1 << MMU_TOP_BITS) - 1)
91 #define MMU_BOT_SHIFT 12
92 #define MMU_BOT_BITS 9
93 #define MMU_BOT_MASK ((1 << MMU_BOT_BITS) - 1)
94 #define MMU_IND_SHIFT 0
95 #define MMU_IND_BITS 12
96 #define MMU_IND_MASK ((1 << MMU_IND_BITS) - 1)
106 #define MMU_KERNEL_RDONLY 0
107 #define MMU_KERNEL_RDWR 1
108 #define MMU_ALL_RDONLY 2
109 #define MMU_ALL_RDWR 3
118 #define MMU_NO_CACHE 1
119 #define MMU_CACHE_BACK 2
120 #define MMU_CACHE_WT 3
121 #define MMU_CACHEABLE MMU_CACHE_BACK
150 #define MMU_SUB_PAGES 512
164 #define MMU_PAGES 1024
265 int count,
int prot,
int cache,
int share,
int dirty);
uint32 dirty
Dirty – 1 bit.
Definition: mmu.h:139
#define MMU_PAGES
The number of sub-contexts in the main level context.
Definition: mmu.h:164
uint32 physical
Physical page ID – 18 bits.
Definition: mmu.h:134
#define MMU_SUB_PAGES
The number of pages in a sub-context.
Definition: mmu.h:150
int mmu_copyin(mmucontext_t *context, uint32 srcaddr, uint32 srccnt, void *buffer)
Copy a chunk of data from a process' address space into a kernel buffer, taking into account page map...
mmupage_t *(* mmu_mapfunc_t)(mmucontext_t *context, int virtpage)
MMU mapping handler.
Definition: mmu.h:303
void mmu_switch_context(mmucontext_t *context)
Switch to the given context.
MMU TLB entry for a single page.
Definition: mmu.h:131
mmu_mapfunc_t mmu_map_get_callback()
Get the current mapping function.
struct mmucontext mmucontext_t
MMU context type.
void mmu_shutdown()
Shutdown MMU support.
uint32 cache
Cacheable – 1 bit.
Definition: mmu.h:138
mmusubcontext_t * sub[MMU_PAGES]
1024 sub-contexts
Definition: mmu.h:174
mmucontext_t * mmu_cxt_current
"Current" page tables (for TLB exception handling).
uint32 pteh
Pre-built PTEH value.
Definition: mmu.h:145
struct mmusubcontext mmusubcontext_t
MMU sub-context type.
int mmu_virt_to_phys(mmucontext_t *context, int virtpage)
Using the given page tables, translate the virtual page ID to a physical page ID. ...
void mmu_page_map(mmucontext_t *context, int virtpage, int physpage, int count, int prot, int cache, int share, int dirty)
Set the given virtual page to map to the given physical page.
int mmu_phys_to_virt(mmucontext_t *context, int physpage)
Using the given page tables, translate the physical page ID to a virtual page ID. ...
mmucontext_t * mmu_context_create(int asid)
Allocate a new MMU context.
unsigned long uint32
32-bit unsigned integer
Definition: types.h:28
mmu_mapfunc_t mmu_map_set_callback(mmu_mapfunc_t newfunc)
Set a new MMU mapping handler.
struct mmupage mmupage_t
MMU TLB entry for a single page.
void mmu_use_table(mmucontext_t *context)
Set the "current" page tables for TLB handling.
int mmu_copyv(mmucontext_t *context1, iovec_t *iov1, int iovcnt1, mmucontext_t *context2, iovec_t *iov2, int iovcnt2)
Copy a chunk of data from one process' address space to another process' address space, taking into account page mappings.
Scatter/Gather array.
Definition: iovec.h:27
uint32 prkey
Protection key data – 2 bits.
Definition: mmu.h:135
mmupage_t page[MMU_SUB_PAGES]
512 page entries
Definition: mmu.h:160
uint32 blank
Reserved – 7 bits.
Definition: mmu.h:141
MMU context type.
Definition: mmu.h:173
uint32 shared
Shared between procs – 1 bit.
Definition: mmu.h:137
uint32 wthru
Write-thru enable – 1 bit.
Definition: mmu.h:140
MMU sub-context type.
Definition: mmu.h:159
void mmu_context_destroy(mmucontext_t *context)
Destroy an MMU context when a process is being destroyed.
uint32 ptel
Pre-built PTEL value.
Definition: mmu.h:146
uint32 valid
Valid mapping – 1 bit.
Definition: mmu.h:136
int mmu_init()
Initialize MMU support.
int asid
Address Space ID.
Definition: mmu.h:175