diff --git a/include/mango/pmap.h b/include/mango/pmap.h index 5a7827a..4ba2836 100644 --- a/include/mango/pmap.h +++ b/include/mango/pmap.h @@ -18,6 +18,29 @@ extern "C" { typedef ml_pmap_t pmap_t; typedef ml_pfn_t pfn_t; +enum pmap_fault_flags { + /* if set, the faulting page is present, and the fault is + * protection-related. + * if clear, the faulting page is missing, and the + * fault is due to the missing page. + */ + PMAP_FAULT_PRESENT = 0x01u, + /* if set, the faulting page was accessed from user mode. + * if clear, the faulting page was accessed from kernel mode. + */ + PMAP_FAULT_USER = 0x02u, + /* if set, the fault was caused by a write operation. + * if clear, the faulting page was caused by a read operation. + */ + PMAP_FAULT_WRITE = 0x04u, + /* if set, the fault was caused while fetching an instruction from the + * faulting page. + */ + PMAP_FAULT_IFETCH = 0x08u, + /* if set, the fault was caused by misconfigured page tables */ + PMAP_FAULT_BADCFG = 0x10u, +}; + enum pmap_flags { PMAP_NORMAL = 0x00u, PMAP_HUGEPAGE = 0x01u, @@ -30,6 +53,10 @@ extern pmap_t pmap_create(void); extern void pmap_destroy(pmap_t pmap); extern void pmap_switch(pmap_t pmap); +extern kern_status_t pmap_handle_fault( + virt_addr_t fault_addr, + enum pmap_fault_flags flags); + extern kern_status_t pmap_add( pmap_t pmap, virt_addr_t p,