summaryrefslogtreecommitdiff
path: root/src/sys/vm/vm_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/vm/vm_map.c')
-rw-r--r--src/sys/vm/vm_map.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sys/vm/vm_map.c b/src/sys/vm/vm_map.c
index d8cb4b7..27cdcce 100644
--- a/src/sys/vm/vm_map.c
+++ b/src/sys/vm/vm_map.c
@@ -103,15 +103,19 @@ __vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot)
int
vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot)
{
+ const size_t PSIZE = DEFAULT_PAGESIZE;
int retval;
size_t unmap_len;
struct mmu_map spec_cpy;
+ struct proc *self = proc_self();
if (spec != NULL) {
spec_cpy = *spec;
}
+
/* If this fails, unmap the partial region */
+ len = ALIGN_UP(len, PSIZE);
retval = __vm_map(vas, spec, len, prot);
if (retval != 0) {
printf("vm_map: could not map <%p>\n", spec_cpy.va);
@@ -121,6 +125,11 @@ vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot)
return -1;
}
+ /* Add the range if we can */
+ if (self != NULL) {
+ proc_add_range(self, spec->va, spec->pa, len);
+ }
+
/* Place a guard page at the end */
spec->va = spec_cpy.va + len;
__vm_map(vas, spec, DEFAULT_PAGESIZE, 0);