| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.326 2019/02/23 10:43:37 maxv Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.327 2019/02/23 10:59:12 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran, and by Maxime Villard. | | 8 | * by Andrew Doran, and by Maxime Villard. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -120,27 +120,27 @@ | | | @@ -120,27 +120,27 @@ |
120 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 120 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
121 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 121 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
122 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 122 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
123 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 123 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
124 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 124 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
125 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 125 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
126 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 126 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
127 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 127 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
128 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 128 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
129 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 129 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
130 | */ | | 130 | */ |
131 | | | 131 | |
132 | #include <sys/cdefs.h> | | 132 | #include <sys/cdefs.h> |
133 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.326 2019/02/23 10:43:37 maxv Exp $"); | | 133 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.327 2019/02/23 10:59:12 maxv Exp $"); |
134 | | | 134 | |
135 | #include "opt_user_ldt.h" | | 135 | #include "opt_user_ldt.h" |
136 | #include "opt_lockdebug.h" | | 136 | #include "opt_lockdebug.h" |
137 | #include "opt_multiprocessor.h" | | 137 | #include "opt_multiprocessor.h" |
138 | #include "opt_xen.h" | | 138 | #include "opt_xen.h" |
139 | #include "opt_svs.h" | | 139 | #include "opt_svs.h" |
140 | #include "opt_kasan.h" | | 140 | #include "opt_kasan.h" |
141 | #include "opt_kaslr.h" | | 141 | #include "opt_kaslr.h" |
142 | | | 142 | |
143 | #include <sys/param.h> | | 143 | #include <sys/param.h> |
144 | #include <sys/systm.h> | | 144 | #include <sys/systm.h> |
145 | #include <sys/proc.h> | | 145 | #include <sys/proc.h> |
146 | #include <sys/pool.h> | | 146 | #include <sys/pool.h> |
| @@ -277,34 +277,26 @@ static vaddr_t pmap_maxkvaddr; | | | @@ -277,34 +277,26 @@ static vaddr_t pmap_maxkvaddr; |
277 | #define PMAP_SUBOBJ_LOCK(pm, idx) /* nothing */ | | 277 | #define PMAP_SUBOBJ_LOCK(pm, idx) /* nothing */ |
278 | #define PMAP_SUBOBJ_UNLOCK(pm, idx) /* nothing */ | | 278 | #define PMAP_SUBOBJ_UNLOCK(pm, idx) /* nothing */ |
279 | #endif /* defined(DIAGNOSTIC) */ | | 279 | #endif /* defined(DIAGNOSTIC) */ |
280 | | | 280 | |
281 | /* | | 281 | /* |
282 | * Misc. event counters. | | 282 | * Misc. event counters. |
283 | */ | | 283 | */ |
284 | struct evcnt pmap_iobmp_evcnt; | | 284 | struct evcnt pmap_iobmp_evcnt; |
285 | struct evcnt pmap_ldt_evcnt; | | 285 | struct evcnt pmap_ldt_evcnt; |
286 | | | 286 | |
287 | /* | | 287 | /* |
288 | * PAT | | 288 | * PAT |
289 | */ | | 289 | */ |
290 | #define PATENTRY(n, type) (type << ((n) * 8)) | | | |
291 | #define PAT_UC 0x0ULL | | | |
292 | #define PAT_WC 0x1ULL | | | |
293 | #define PAT_WT 0x4ULL | | | |
294 | #define PAT_WP 0x5ULL | | | |
295 | #define PAT_WB 0x6ULL | | | |
296 | #define PAT_UCMINUS 0x7ULL | | | |
297 | | | | |
298 | static bool cpu_pat_enabled __read_mostly = false; | | 290 | static bool cpu_pat_enabled __read_mostly = false; |
299 | | | 291 | |
300 | /* | | 292 | /* |
301 | * Global data structures | | 293 | * Global data structures |
302 | */ | | 294 | */ |
303 | | | 295 | |
304 | static struct pmap kernel_pmap_store; /* the kernel's pmap (proc0) */ | | 296 | static struct pmap kernel_pmap_store; /* the kernel's pmap (proc0) */ |
305 | struct pmap *const kernel_pmap_ptr = &kernel_pmap_store; | | 297 | struct pmap *const kernel_pmap_ptr = &kernel_pmap_store; |
306 | | | 298 | |
307 | struct bootspace bootspace __read_mostly; | | 299 | struct bootspace bootspace __read_mostly; |
308 | struct slotspace slotspace __read_mostly; | | 300 | struct slotspace slotspace __read_mostly; |
309 | | | 301 | |
310 | /* Set to PG_NX if supported. */ | | 302 | /* Set to PG_NX if supported. */ |