Sat Apr 18 17:22:26 2020 UTC ()
Fix trailing whitespace.


(riastradh)
diff -r1.379 -r1.380 src/sys/uvm/uvm_map.c

cvs diff -r1.379 -r1.380 src/sys/uvm/uvm_map.c (expand / switch to unified diff)

--- src/sys/uvm/uvm_map.c 2020/04/18 03:27:13 1.379
+++ src/sys/uvm/uvm_map.c 2020/04/18 17:22:26 1.380
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_map.c,v 1.379 2020/04/18 03:27:13 thorpej Exp $ */ 1/* $NetBSD: uvm_map.c,v 1.380 2020/04/18 17:22:26 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Charles D. Cranor and Washington University. 4 * Copyright (c) 1997 Charles D. Cranor and Washington University.
5 * Copyright (c) 1991, 1993, The Regents of the University of California. 5 * Copyright (c) 1991, 1993, The Regents of the University of California.
6 * 6 *
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * This code is derived from software contributed to Berkeley by 9 * This code is derived from software contributed to Berkeley by
10 * The Mach Operating System project at Carnegie-Mellon University. 10 * The Mach Operating System project at Carnegie-Mellon University.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -56,27 +56,27 @@ @@ -56,27 +56,27 @@
56 * School of Computer Science 56 * School of Computer Science
57 * Carnegie Mellon University 57 * Carnegie Mellon University
58 * Pittsburgh PA 15213-3890 58 * Pittsburgh PA 15213-3890
59 * 59 *
60 * any improvements or extensions that they make and grant Carnegie the 60 * any improvements or extensions that they make and grant Carnegie the
61 * rights to redistribute these changes. 61 * rights to redistribute these changes.
62 */ 62 */
63 63
64/* 64/*
65 * uvm_map.c: uvm map operations 65 * uvm_map.c: uvm map operations
66 */ 66 */
67 67
68#include <sys/cdefs.h> 68#include <sys/cdefs.h>
69__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.379 2020/04/18 03:27:13 thorpej Exp $"); 69__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.380 2020/04/18 17:22:26 riastradh Exp $");
70 70
71#include "opt_ddb.h" 71#include "opt_ddb.h"
72#include "opt_pax.h" 72#include "opt_pax.h"
73#include "opt_uvmhist.h" 73#include "opt_uvmhist.h"
74#include "opt_uvm.h" 74#include "opt_uvm.h"
75#include "opt_sysv.h" 75#include "opt_sysv.h"
76 76
77#include <sys/param.h> 77#include <sys/param.h>
78#include <sys/systm.h> 78#include <sys/systm.h>
79#include <sys/mman.h> 79#include <sys/mman.h>
80#include <sys/proc.h> 80#include <sys/proc.h>
81#include <sys/pool.h> 81#include <sys/pool.h>
82#include <sys/kernel.h> 82#include <sys/kernel.h>
@@ -2603,27 +2603,27 @@ uvm_map_extract(struct vm_map *srcmap, v @@ -2603,27 +2603,27 @@ uvm_map_extract(struct vm_map *srcmap, v
2603 * REMOVE. 2603 * REMOVE.
2604 */ 2604 */
2605 2605
2606 KASSERT((start & PAGE_MASK) == 0 && (len & PAGE_MASK) == 0); 2606 KASSERT((start & PAGE_MASK) == 0 && (len & PAGE_MASK) == 0);
2607 KASSERT((flags & UVM_EXTRACT_REMOVE) == 0 || 2607 KASSERT((flags & UVM_EXTRACT_REMOVE) == 0 ||
2608 (flags & (UVM_EXTRACT_CONTIG|UVM_EXTRACT_QREF)) == 0); 2608 (flags & (UVM_EXTRACT_CONTIG|UVM_EXTRACT_QREF)) == 0);
2609 2609
2610 /* 2610 /*
2611 * step 1: reserve space in the target map for the extracted area 2611 * step 1: reserve space in the target map for the extracted area
2612 */ 2612 */
2613 2613
2614 if ((flags & UVM_EXTRACT_RESERVED) == 0) { 2614 if ((flags & UVM_EXTRACT_RESERVED) == 0) {
2615 dstaddr = vm_map_min(dstmap); 2615 dstaddr = vm_map_min(dstmap);
2616 if (!uvm_map_reserve(dstmap, len, start,  2616 if (!uvm_map_reserve(dstmap, len, start,
2617 atop(start) & uvmexp.colormask, &dstaddr, 2617 atop(start) & uvmexp.colormask, &dstaddr,
2618 UVM_FLAG_COLORMATCH)) 2618 UVM_FLAG_COLORMATCH))
2619 return (ENOMEM); 2619 return (ENOMEM);
2620 KASSERT((atop(start ^ dstaddr) & uvmexp.colormask) == 0); 2620 KASSERT((atop(start ^ dstaddr) & uvmexp.colormask) == 0);
2621 *dstaddrp = dstaddr; /* pass address back to caller */ 2621 *dstaddrp = dstaddr; /* pass address back to caller */
2622 UVMHIST_LOG(maphist, " dstaddr=%#jx", dstaddr,0,0,0); 2622 UVMHIST_LOG(maphist, " dstaddr=%#jx", dstaddr,0,0,0);
2623 } else { 2623 } else {
2624 dstaddr = *dstaddrp; 2624 dstaddr = *dstaddrp;
2625 } 2625 }
2626 2626
2627 /* 2627 /*
2628 * step 2: setup for the extraction process loop by init'ing the 2628 * step 2: setup for the extraction process loop by init'ing the
2629 * map entry chain, locking src map, and looking up the first useful 2629 * map entry chain, locking src map, and looking up the first useful
@@ -4161,27 +4161,27 @@ uvmspace_exec(struct lwp *l, vaddr_t sta @@ -4161,27 +4161,27 @@ uvmspace_exec(struct lwp *l, vaddr_t sta
4161 */ 4161 */
4162 if (uvm_shmexit && ovm->vm_shm) 4162 if (uvm_shmexit && ovm->vm_shm)
4163 (*uvm_shmexit)(ovm); 4163 (*uvm_shmexit)(ovm);
4164 4164
4165 /* 4165 /*
4166 * POSIX 1003.1b -- "lock future mappings" is revoked 4166 * POSIX 1003.1b -- "lock future mappings" is revoked
4167 * when a process execs another program image. 4167 * when a process execs another program image.
4168 */ 4168 */
4169 4169
4170 map->flags &= ~VM_MAP_WIREFUTURE; 4170 map->flags &= ~VM_MAP_WIREFUTURE;
4171 4171
4172 /* 4172 /*
4173 * now unmap the old program. 4173 * now unmap the old program.
4174 *  4174 *
4175 * XXX set VM_MAP_DYING for the duration, so pmap_update() 4175 * XXX set VM_MAP_DYING for the duration, so pmap_update()
4176 * is not called until the pmap has been totally cleared out 4176 * is not called until the pmap has been totally cleared out
4177 * after pmap_remove_all(), or it can confuse some pmap 4177 * after pmap_remove_all(), or it can confuse some pmap
4178 * implementations. it would be nice to handle this by 4178 * implementations. it would be nice to handle this by
4179 * deferring the pmap_update() while it is known the address 4179 * deferring the pmap_update() while it is known the address
4180 * space is not visible to any user LWP other than curlwp, 4180 * space is not visible to any user LWP other than curlwp,
4181 * but there isn't an elegant way of inferring that right 4181 * but there isn't an elegant way of inferring that right
4182 * now. 4182 * now.
4183 */ 4183 */
4184 4184
4185 flags = pmap_remove_all(map->pmap) ? UVM_FLAG_VAONLY : 0; 4185 flags = pmap_remove_all(map->pmap) ? UVM_FLAG_VAONLY : 0;
4186 map->flags |= VM_MAP_DYING; 4186 map->flags |= VM_MAP_DYING;
4187 uvm_unmap1(map, vm_map_min(map), vm_map_max(map), flags); 4187 uvm_unmap1(map, vm_map_min(map), vm_map_max(map), flags);
@@ -5010,48 +5010,48 @@ uvm_voaddr_release(struct uvm_voaddr * c @@ -5010,48 +5010,48 @@ uvm_voaddr_release(struct uvm_voaddr * c
5010 * 5010 *
5011 * => memcmp() semantics 5011 * => memcmp() semantics
5012 */ 5012 */
5013int 5013int
5014uvm_voaddr_compare(const struct uvm_voaddr * const voaddr1, 5014uvm_voaddr_compare(const struct uvm_voaddr * const voaddr1,
5015 const struct uvm_voaddr * const voaddr2) 5015 const struct uvm_voaddr * const voaddr2)
5016{ 5016{
5017 5017
5018 KASSERT(voaddr1->type == UVM_VOADDR_TYPE_OBJECT || 5018 KASSERT(voaddr1->type == UVM_VOADDR_TYPE_OBJECT ||
5019 voaddr1->type == UVM_VOADDR_TYPE_ANON); 5019 voaddr1->type == UVM_VOADDR_TYPE_ANON);
5020 5020
5021 KASSERT(voaddr2->type == UVM_VOADDR_TYPE_OBJECT || 5021 KASSERT(voaddr2->type == UVM_VOADDR_TYPE_OBJECT ||
5022 voaddr2->type == UVM_VOADDR_TYPE_ANON); 5022 voaddr2->type == UVM_VOADDR_TYPE_ANON);
5023  5023
5024 if (voaddr1->type < voaddr2->type) 5024 if (voaddr1->type < voaddr2->type)
5025 return -1; 5025 return -1;
5026 if (voaddr1->type > voaddr2->type) 5026 if (voaddr1->type > voaddr2->type)
5027 return 1; 5027 return 1;
5028  5028
5029 /* These fields are unioned together. */ 5029 /* These fields are unioned together. */
5030 CTASSERT(offsetof(struct uvm_voaddr, uobj) == 5030 CTASSERT(offsetof(struct uvm_voaddr, uobj) ==
5031 offsetof(struct uvm_voaddr, anon)); 5031 offsetof(struct uvm_voaddr, anon));
5032 const uintptr_t addr1 = (uintptr_t)voaddr1->uobj; 5032 const uintptr_t addr1 = (uintptr_t)voaddr1->uobj;
5033 const uintptr_t addr2 = (uintptr_t)voaddr2->uobj; 5033 const uintptr_t addr2 = (uintptr_t)voaddr2->uobj;
5034 5034
5035 if (addr1 < addr2) 5035 if (addr1 < addr2)
5036 return -1; 5036 return -1;
5037 if (addr1 > addr2) 5037 if (addr1 > addr2)
5038 return 1; 5038 return 1;
5039  5039
5040 if (voaddr1->offset < voaddr2->offset) 5040 if (voaddr1->offset < voaddr2->offset)
5041 return -1; 5041 return -1;
5042 if (voaddr1->offset > voaddr2->offset) 5042 if (voaddr1->offset > voaddr2->offset)
5043 return 1; 5043 return 1;
5044  5044
5045 return 0; 5045 return 0;
5046} 5046}
5047 5047
5048#if defined(DDB) || defined(DEBUGPRINT) 5048#if defined(DDB) || defined(DEBUGPRINT)
5049 5049
5050/* 5050/*
5051 * uvm_map_printit: actually prints the map 5051 * uvm_map_printit: actually prints the map
5052 */ 5052 */
5053 5053
5054void 5054void
5055uvm_map_printit(struct vm_map *map, bool full, 5055uvm_map_printit(struct vm_map *map, bool full,
5056 void (*pr)(const char *, ...)) 5056 void (*pr)(const char *, ...))
5057{ 5057{