From 21f008676433d426c255bf782780081bb72a4cfa Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 27 Sep 2025 20:16:17 -0400 Subject: kern: vm: Don't clobber original map spec Signed-off-by: Ian Moffett --- src/sys/vm/vm_map.c | 11 ++++++----- 1 file 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; -- cgit v1.2.3