diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-27 20:16:17 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-27 20:16:17 -0400 |
commit | 21f008676433d426c255bf782780081bb72a4cfa (patch) | |
tree | d1da35d3e85f28c04d4afc65a0e6862e79a33b18 /src/sys/vm | |
parent | 05aba6ee4eaf6e235c9f7da19778d818ded0eab2 (diff) |
kern: vm: Don't clobber original map spec
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/vm')
-rw-r--r-- | src/sys/vm/vm_map.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sys/vm/vm_map.c b/src/sys/vm/vm_map.c index c724168..6748348 100644 --- a/src/sys/vm/vm_map.c +++ b/src/sys/vm/vm_map.c @@ -44,6 +44,7 @@ static int __vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot) { const size_t PSIZE = DEFAULT_PAGESIZE; + struct mmu_map tmp_spec; vaddr_t va_cur, va_end; vaddr_t va_start; int error; @@ -74,8 +75,8 @@ __vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot) } /* Must be on a 4K boundary */ - spec->va = ALIGN_DOWN(spec->va, PSIZE); - spec->pa = ALIGN_DOWN(spec->pa, PSIZE); + tmp_spec.va = ALIGN_DOWN(spec->va, PSIZE); + tmp_spec.pa = ALIGN_DOWN(spec->pa, PSIZE); /* * start: always the mapping base @@ -87,14 +88,14 @@ __vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot) va_end = spec->va + len; while (va_cur < va_end) { - error = mmu_map_single(vas, spec, prot); + error = mmu_map_single(vas, &tmp_spec, prot); if (error < 0) { return spec->va; } va_cur += PSIZE; - spec->va += PSIZE; - spec->pa += PSIZE; + tmp_spec.va += PSIZE; + tmp_spec.pa += PSIZE; } return 0; |