diff options
Diffstat (limited to 'pk')
-rw-r--r-- | pk/mmap.c | 4 | ||||
-rw-r--r-- | pk/mmap.h | 2 | ||||
-rw-r--r-- | pk/pk.c | 4 |
3 files changed, 7 insertions, 3 deletions
@@ -24,7 +24,7 @@ static uintptr_t first_free_page; static size_t next_free_page; static size_t free_pages; -int have_vm = 1; // unless -p flag is given +int demand_paging = 1; // unless -p flag is given static uintptr_t __page_alloc() { @@ -244,7 +244,7 @@ uintptr_t __do_mmap(uintptr_t addr, size_t length, int prot, int flags, file_t* *pte = (pte_t)v; } - if (!have_vm || (flags & MAP_POPULATE)) + if (!demand_paging || (flags & MAP_POPULATE)) for (uintptr_t a = addr; a < addr + length; a += RISCV_PGSIZE) kassert(__handle_page_fault(a, prot) == 0); @@ -19,7 +19,7 @@ #define MAP_POPULATE 0x8000 #define MREMAP_FIXED 0x2 -extern int have_vm; +extern int demand_paging; uintptr_t pk_vm_init(); int handle_page_fault(uintptr_t vaddr, int prot); void populate_mapping(const void* start, size_t size, int prot); @@ -16,6 +16,10 @@ static void handle_option(const char* s) current.cycle0 = 1; break; + case 'p': // disable demand paging + demand_paging = 0; + break; + default: panic("unrecognized option: `%c'", s[1]); break; |