96#define MMU_TOP_SHIFT 21
97#define MMU_TOP_BITS 10
98#define MMU_TOP_MASK ((1 << MMU_TOP_BITS) - 1)
99#define MMU_BOT_SHIFT 12
100#define MMU_BOT_BITS 9
101#define MMU_BOT_MASK ((1 << MMU_BOT_BITS) - 1)
102#define MMU_IND_SHIFT 0
103#define MMU_IND_BITS 12
104#define MMU_IND_MASK ((1 << MMU_IND_BITS) - 1)
116#define MMU_KERNEL_RDONLY 0
117#define MMU_KERNEL_RDWR 1
118#define MMU_ALL_RDONLY 2
119#define MMU_ALL_RDWR 3
130#define MMU_NO_CACHE 1
131#define MMU_CACHE_BACK 2
132#define MMU_CACHE_WT 3
133#define MMU_CACHEABLE MMU_CACHE_BACK
144typedef struct mmupage {
165#define MMU_SUB_PAGES 512
175typedef struct mmusubcontext {
180#define MMU_PAGES 1024
190typedef struct mmucontext {
289 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:165
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:331
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_set_sq_addr(void *addr)
Reset the base target address for store queues.
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...
bool mmu_enabled(void)
Check if MMU translation is enabled.
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:180
I/O vector structure.
Definition uio.h:34
MMU context type.
Definition mmu.h:190
int asid
Address Space ID.
Definition mmu.h:192
MMU TLB entry for a single page.
Definition mmu.h:144
uint32 shared
Shared between procs – 1 bit.
Definition mmu.h:150
uint32 dirty
Dirty – 1 bit.
Definition mmu.h:152
uint32 prkey
Protection key data – 2 bits.
Definition mmu.h:148
uint32 blank
Reserved – 7 bits.
Definition mmu.h:154
uint32 cache
Cacheable – 1 bit.
Definition mmu.h:151
uint32 pteh
Pre-built PTEH value.
Definition mmu.h:158
uint32 wthru
Write-thru enable – 1 bit.
Definition mmu.h:153
uint32 valid
Valid mapping – 1 bit.
Definition mmu.h:149
uint32 ptel
Pre-built PTEL value.
Definition mmu.h:159
uint32 physical
Physical page ID – 18 bits.
Definition mmu.h:147
MMU sub-context type.
Definition mmu.h:175
Header for terminal control operations.