From b775750902897fa512fd535199284b2fb0fd0453 Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Wed, 18 Dec 2019 13:33:30 +0000 Subject: Set vm_map's pmap in uvm_map_setup(). OK guenther@, kettenis@, mpi@ --- sys/uvm/uvm_km.c | 8 +++----- sys/uvm/uvm_map.c | 12 ++++++------ sys/uvm/uvm_map.h | 4 ++-- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'sys/uvm') diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index f9ec890670e..dc38613d7a0 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.133 2019/12/08 12:37:45 mpi Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.134 2019/12/18 13:33:29 visa Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -168,14 +168,13 @@ uvm_km_init(vaddr_t base, vaddr_t start, vaddr_t end) * before installing. */ - uvm_map_setup(&kernel_map_store, base, end, + uvm_map_setup(&kernel_map_store, pmap_kernel(), base, end, #ifdef KVA_GUARDPAGES VM_MAP_PAGEABLE | VM_MAP_GUARDPAGES #else VM_MAP_PAGEABLE #endif ); - kernel_map_store.pmap = pmap_kernel(); if (base != start && uvm_map(&kernel_map_store, &base, start - base, NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE, @@ -220,8 +219,7 @@ uvm_km_suballoc(struct vm_map *map, vaddr_t *min, vaddr_t *max, vsize_t size, if (submap == NULL) panic("uvm_km_suballoc: unable to create submap"); } else { - uvm_map_setup(submap, *min, *max, flags); - submap->pmap = vm_map_pmap(map); + uvm_map_setup(submap, vm_map_pmap(map), *min, *max, flags); } /* now let uvm_map_submap plug in it... */ diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 3e280f05a3b..b53b6162541 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.260 2019/12/18 08:53:29 kettenis Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.261 2019/12/18 13:33:29 visa Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -2619,7 +2619,8 @@ uvm_map_pageable_all(struct vm_map *map, int flags, vsize_t limit) * Allocates sufficient entries to describe the free memory in the map. */ void -uvm_map_setup(struct vm_map *map, vaddr_t min, vaddr_t max, int flags) +uvm_map_setup(struct vm_map *map, pmap_t pmap, vaddr_t min, vaddr_t max, + int flags) { int i; @@ -2646,6 +2647,7 @@ uvm_map_setup(struct vm_map *map, vaddr_t min, vaddr_t max, int flags) map->uaddr_any[i] = NULL; map->uaddr_brk_stack = NULL; + map->pmap = pmap; map->size = 0; map->ref_count = 0; map->min_offset = min; @@ -3460,9 +3462,8 @@ uvmspace_init(struct vmspace *vm, struct pmap *pmap, vaddr_t min, vaddr_t max, pmap_reference(pmap); else pmap = pmap_create(); - vm->vm_map.pmap = pmap; - uvm_map_setup(&vm->vm_map, min, max, + uvm_map_setup(&vm->vm_map, pmap, min, max, (pageable ? VM_MAP_PAGEABLE : 0) | VM_MAP_ISVMSPACE); vm->vm_refcnt = 1; @@ -4230,8 +4231,7 @@ uvm_map_create(pmap_t pmap, vaddr_t min, vaddr_t max, int flags) vm_map_t map; map = malloc(sizeof *map, M_VMMAP, M_WAITOK); - map->pmap = pmap; - uvm_map_setup(map, min, max, flags); + uvm_map_setup(map, pmap, min, max, flags); return (map); } diff --git a/sys/uvm/uvm_map.h b/sys/uvm/uvm_map.h index 4dc26a0eb3b..2703c66d538 100644 --- a/sys/uvm/uvm_map.h +++ b/sys/uvm/uvm_map.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.h,v 1.66 2019/12/12 11:12:37 mpi Exp $ */ +/* $OpenBSD: uvm_map.h,v 1.67 2019/12/18 13:33:29 visa Exp $ */ /* $NetBSD: uvm_map.h,v 1.24 2001/02/18 21:19:08 chs Exp $ */ /* @@ -359,7 +359,7 @@ int uvm_map_replace(struct vm_map *, vaddr_t, vaddr_t, vm_map_entry_t, int); int uvm_map_reserve(struct vm_map *, vsize_t, vaddr_t, vsize_t, vaddr_t *); -void uvm_map_setup(struct vm_map *, vaddr_t, vaddr_t, int); +void uvm_map_setup(struct vm_map *, pmap_t, vaddr_t, vaddr_t, int); int uvm_map_submap(struct vm_map *, vaddr_t, vaddr_t, struct vm_map *); void uvm_unmap(struct vm_map *, vaddr_t, vaddr_t); -- cgit v1.2.3