diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-06-02 14:42:35 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-06-02 14:42:35 -0700 |
commit | 0b66cbb5a9584ae46c0269b0d94456899d775dfd (patch) | |
tree | 199a341a5d6b83816c58a1444d29bdef1aff41bf | |
parent | c31914e9440a460e20cd419f4da3d2830ec98442 (diff) | |
download | pk-0b66cbb5a9584ae46c0269b0d94456899d775dfd.zip pk-0b66cbb5a9584ae46c0269b0d94456899d775dfd.tar.gz pk-0b66cbb5a9584ae46c0269b0d94456899d775dfd.tar.bz2 |
Fix regression causing sbrk to fail spuriously
-rw-r--r-- | pk/vm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -259,9 +259,6 @@ uintptr_t __do_mmap(uintptr_t addr, size_t length, int prot, int flags, file_t* for (uintptr_t a = addr; a < addr + length; a += RISCV_PGSIZE) kassert(__handle_page_fault(a, prot) == 0); - if (current.brk_min != 0 && addr < current.brk_max) - current.brk_max = ROUNDUP(addr + length, RISCV_PGSIZE); - return addr; } @@ -288,6 +285,9 @@ uintptr_t do_mmap(uintptr_t addr, size_t length, int prot, int flags, int fd, of spinlock_lock(&vm_lock); addr = __do_mmap(addr, length, prot, flags, f, offset); + + if (addr < current.brk_max) + current.brk_max = ROUNDUP(addr + length, RISCV_PGSIZE); spinlock_unlock(&vm_lock); if (f) file_decref(f); |