aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-09-09 18:24:28 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-09-09 18:24:28 -0700
commit4a6b20595a77a0d3e4e507563232a55ff74febf0 (patch)
tree1bd78652a92f37a00c0f21def88a7aaf5cdabb8d /pk
parent292fb6e737b59178ac1911527e995abd161da329 (diff)
downloadpk-4a6b20595a77a0d3e4e507563232a55ff74febf0.zip
pk-4a6b20595a77a0d3e4e507563232a55ff74febf0.tar.gz
pk-4a6b20595a77a0d3e4e507563232a55ff74febf0.tar.bz2
Add -p flag to pk to disable demand paging
Diffstat (limited to 'pk')
-rw-r--r--pk/mmap.c4
-rw-r--r--pk/mmap.h2
-rw-r--r--pk/pk.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/pk/mmap.c b/pk/mmap.c
index db491d7..e00d18e 100644
--- a/pk/mmap.c
+++ b/pk/mmap.c
@@ -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);
diff --git a/pk/mmap.h b/pk/mmap.h
index 3fc3186..f4f39f5 100644
--- a/pk/mmap.h
+++ b/pk/mmap.h
@@ -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);
diff --git a/pk/pk.c b/pk/pk.c
index 954bcb3..6a27b4e 100644
--- a/pk/pk.c
+++ b/pk/pk.c
@@ -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;