aboutsummaryrefslogtreecommitdiff
path: root/pk
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-04-24 19:52:01 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-04-24 19:52:01 -0700
commit2d8f51fcca517101c80e9c425058b0171daef22e (patch)
tree90744b08055bebf7b2f7a8a5a6a1f3d6d0e2f61c /pk
parent15b3ac1e94a482ec22da49932475ec76b3f5392b (diff)
downloadpk-2d8f51fcca517101c80e9c425058b0171daef22e.zip
pk-2d8f51fcca517101c80e9c425058b0171daef22e.tar.gz
pk-2d8f51fcca517101c80e9c425058b0171daef22e.tar.bz2
"Fix" RV32 programs running on RV64 pk
Only allocate virtual addresses under 2^31. We might revise the RV32-on-RV64 semantics to zero-extend the RV32 virtual addresses, which would allow the user program's use of the full 4 GB.
Diffstat (limited to 'pk')
-rw-r--r--pk/vm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pk/vm.c b/pk/vm.c
index 0719a4b..f66f8f1 100644
--- a/pk/vm.c
+++ b/pk/vm.c
@@ -485,6 +485,10 @@ void supervisor_vm_init()
uintptr_t pk_vm_init()
{
+ // keep RV32 addresses positive
+ if (!current.elf64)
+ current.mmap_max = MIN(current.mmap_max, 0x80000000);
+
__map_kernel_range(0, 0, current.first_free_paddr, PROT_READ|PROT_WRITE|PROT_EXEC);
__map_kernel_range(first_free_page, first_free_page, free_pages * RISCV_PGSIZE, PROT_READ|PROT_WRITE);