94#define MMU_TOP_SHIFT 21
95#define MMU_TOP_BITS 10
96#define MMU_TOP_MASK ((1 << MMU_TOP_BITS) - 1)
97#define MMU_BOT_SHIFT 12
99#define MMU_BOT_MASK ((1 << MMU_BOT_BITS) - 1)
100#define MMU_IND_SHIFT 0
101#define MMU_IND_BITS 12
102#define MMU_IND_MASK ((1 << MMU_IND_BITS) - 1)
114#define MMU_KERNEL_RDONLY 0
115#define MMU_KERNEL_RDWR 1
116#define MMU_ALL_RDONLY 2
117#define MMU_ALL_RDWR 3
128#define MMU_NO_CACHE 1
129#define MMU_CACHE_BACK 2
130#define MMU_CACHE_WT 3
131#define MMU_CACHEABLE MMU_CACHE_BACK
142typedef struct mmupage {
163#define MMU_SUB_PAGES 512
173typedef struct mmusubcontext {
178#define MMU_PAGES 1024
188typedef struct mmucontext {
200typedef struct mmu_token *mmu_token_t;
290 int count,
int prot,
int cache,
int share,
int dirty);
void mmu_context_destroy(mmucontext_t *context)
Destroy an MMU context when a process is being destroyed.
mmu_mapfunc_t mmu_map_set_callback(mmu_mapfunc_t newfunc)
Set a new MMU mapping handler.
#define MMU_SUB_PAGES
The number of pages in a sub-context.
Definition mmu.h:163
void mmu_restore(mmu_token_t token)
Restore MMU address translation.
void mmu_switch_context(mmucontext_t *context)
Switch to the given context.
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.
mmupage_t *(* mmu_mapfunc_t)(mmucontext_t *context, int virtpage)
MMU mapping handler.
Definition mmu.h:332
mmucontext_t * mmu_context_create(int asid)
Allocate a new MMU context.
int mmu_init(void)
Initialize MMU support.
void mmu_use_table(mmucontext_t *context)
Set the "current" page tables for TLB handling.
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_shutdown(void)
Shutdown MMU support.
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.
void mmu_reset_itlb(void)
Reset ITLB.
int mmu_copyv(mmucontext_t *context1, struct iovec *iov1, int iovcnt1, mmucontext_t *context2, struct iovec *iov2, int iovcnt2)
Copy a chunk of data from one process' address space to another process' address space,...
mmu_mapfunc_t mmu_map_get_callback(void)
Get the current mapping function.
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...
mmu_token_t mmu_disable(void)
Temporarily disable MMU address translation.
unsigned long uint32
32-bit unsigned integer
Definition types.h:33
#define MMU_PAGES
The number of sub-contexts in the main level context.
Definition mmu.h:178
I/O vector structure.
Definition uio.h:34
MMU context type.
Definition mmu.h:188
int asid
Address Space ID.
Definition mmu.h:190
MMU TLB entry for a single page.
Definition mmu.h:142
uint32 shared
Shared between procs – 1 bit.
Definition mmu.h:148
uint32 dirty
Dirty – 1 bit.
Definition mmu.h:150
uint32 prkey
Protection key data – 2 bits.
Definition mmu.h:146
uint32 blank
Reserved – 7 bits.
Definition mmu.h:152
uint32 cache
Cacheable – 1 bit.
Definition mmu.h:149
uint32 pteh
Pre-built PTEH value.
Definition mmu.h:156
uint32 wthru
Write-thru enable – 1 bit.
Definition mmu.h:151
uint32 valid
Valid mapping – 1 bit.
Definition mmu.h:147
uint32 ptel
Pre-built PTEL value.
Definition mmu.h:157
uint32 physical
Physical page ID – 18 bits.
Definition mmu.h:145
MMU sub-context type.
Definition mmu.h:173
Header for terminal control operations.