| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.74 2022/11/03 09:04:57 skrll Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.74.2.1 2024/04/19 09:18:28 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2001 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 Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center and by Chris G. Demetriou. | | 9 | * NASA Ames Research Center and by Chris G. Demetriou. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
63 | * SUCH DAMAGE. | | 63 | * SUCH DAMAGE. |
64 | * | | 64 | * |
65 | * @(#)pmap.c 8.4 (Berkeley) 1/26/94 | | 65 | * @(#)pmap.c 8.4 (Berkeley) 1/26/94 |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | | | 69 | |
70 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74 2022/11/03 09:04:57 skrll Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74.2.1 2024/04/19 09:18:28 martin Exp $"); |
71 | | | 71 | |
72 | /* | | 72 | /* |
73 | * Manages physical address maps. | | 73 | * Manages physical address maps. |
74 | * | | 74 | * |
75 | * In addition to hardware address maps, this | | 75 | * In addition to hardware address maps, this |
76 | * module is called upon to provide software-use-only | | 76 | * module is called upon to provide software-use-only |
77 | * maps which may or may not be stored in the same | | 77 | * maps which may or may not be stored in the same |
78 | * form as hardware maps. These pseudo-maps are | | 78 | * form as hardware maps. These pseudo-maps are |
79 | * used to store intermediate results from copy | | 79 | * used to store intermediate results from copy |
80 | * operations to and from address spaces. | | 80 | * operations to and from address spaces. |
81 | * | | 81 | * |
82 | * Since the information managed by this module is | | 82 | * Since the information managed by this module is |
83 | * also stored by the logical address mapping module, | | 83 | * also stored by the logical address mapping module, |
| @@ -395,50 +395,50 @@ pmap_addr_range_check(pmap_t pmap, vaddr | | | @@ -395,50 +395,50 @@ pmap_addr_range_check(pmap_t pmap, vaddr |
395 | if (eva > VM_MAXUSER_ADDRESS) | | 395 | if (eva > VM_MAXUSER_ADDRESS) |
396 | panic("%s: uva %#"PRIxVADDR" not in range", | | 396 | panic("%s: uva %#"PRIxVADDR" not in range", |
397 | func, eva); | | 397 | func, eva); |
398 | pmap_asid_check(pmap, func); | | 398 | pmap_asid_check(pmap, func); |
399 | } | | 399 | } |
400 | #endif | | 400 | #endif |
401 | } | | 401 | } |
402 | | | 402 | |
403 | /* | | 403 | /* |
404 | * Misc. functions. | | 404 | * Misc. functions. |
405 | */ | | 405 | */ |
406 | | | 406 | |
407 | bool | | 407 | bool |
408 | pmap_page_clear_attributes(struct vm_page_md *mdpg, u_int clear_attributes) | | 408 | pmap_page_clear_attributes(struct vm_page_md *mdpg, u_long clear_attributes) |
409 | { | | 409 | { |
410 | volatile unsigned long * const attrp = &mdpg->mdpg_attrs; | | 410 | volatile u_long * const attrp = &mdpg->mdpg_attrs; |
411 | | | 411 | |
412 | #ifdef MULTIPROCESSOR | | 412 | #ifdef MULTIPROCESSOR |
413 | for (;;) { | | 413 | for (;;) { |
414 | u_int old_attr = *attrp; | | 414 | u_long old_attr = *attrp; |
415 | if ((old_attr & clear_attributes) == 0) | | 415 | if ((old_attr & clear_attributes) == 0) |
416 | return false; | | 416 | return false; |
417 | u_int new_attr = old_attr & ~clear_attributes; | | 417 | u_long new_attr = old_attr & ~clear_attributes; |
418 | if (old_attr == atomic_cas_ulong(attrp, old_attr, new_attr)) | | 418 | if (old_attr == atomic_cas_ulong(attrp, old_attr, new_attr)) |
419 | return true; | | 419 | return true; |
420 | } | | 420 | } |
421 | #else | | 421 | #else |
422 | unsigned long old_attr = *attrp; | | 422 | u_long old_attr = *attrp; |
423 | if ((old_attr & clear_attributes) == 0) | | 423 | if ((old_attr & clear_attributes) == 0) |
424 | return false; | | 424 | return false; |
425 | *attrp &= ~clear_attributes; | | 425 | *attrp &= ~clear_attributes; |
426 | return true; | | 426 | return true; |
427 | #endif | | 427 | #endif |
428 | } | | 428 | } |
429 | | | 429 | |
430 | void | | 430 | void |
431 | pmap_page_set_attributes(struct vm_page_md *mdpg, u_int set_attributes) | | 431 | pmap_page_set_attributes(struct vm_page_md *mdpg, u_long set_attributes) |
432 | { | | 432 | { |
433 | #ifdef MULTIPROCESSOR | | 433 | #ifdef MULTIPROCESSOR |
434 | atomic_or_ulong(&mdpg->mdpg_attrs, set_attributes); | | 434 | atomic_or_ulong(&mdpg->mdpg_attrs, set_attributes); |
435 | #else | | 435 | #else |
436 | mdpg->mdpg_attrs |= set_attributes; | | 436 | mdpg->mdpg_attrs |= set_attributes; |
437 | #endif | | 437 | #endif |
438 | } | | 438 | } |
439 | | | 439 | |
440 | static void | | 440 | static void |
441 | pmap_page_syncicache(struct vm_page *pg) | | 441 | pmap_page_syncicache(struct vm_page *pg) |
442 | { | | 442 | { |
443 | UVMHIST_FUNC(__func__); | | 443 | UVMHIST_FUNC(__func__); |
444 | UVMHIST_CALLED(pmaphist); | | 444 | UVMHIST_CALLED(pmaphist); |