| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.209 2013/11/10 18:27:15 christos Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.210 2014/04/23 20:57:15 skrll 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.209 2013/11/10 18:27:15 christos Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.210 2014/04/23 20:57:15 skrll 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, |
| @@ -444,36 +444,38 @@ pmap_map_ephemeral_page(struct vm_page * | | | @@ -444,36 +444,38 @@ pmap_map_ephemeral_page(struct vm_page * |
444 | } | | 444 | } |
445 | | | 445 | |
446 | return va; | | 446 | return va; |
447 | } | | 447 | } |
448 | | | 448 | |
449 | static void | | 449 | static void |
450 | pmap_unmap_ephemeral_page(struct vm_page *pg, vaddr_t va, | | 450 | pmap_unmap_ephemeral_page(struct vm_page *pg, vaddr_t va, |
451 | pt_entry_t old_pt_entry) | | 451 | pt_entry_t old_pt_entry) |
452 | { | | 452 | { |
453 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | | 453 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); |
454 | pv_entry_t pv = &md->pvh_first; | | 454 | pv_entry_t pv = &md->pvh_first; |
455 | | | 455 | |
456 | (void)PG_MD_PVLIST_LOCK(md, false); | | 456 | (void)PG_MD_PVLIST_LOCK(md, false); |
457 | if (MIPS_CACHE_VIRTUAL_ALIAS | | 457 | if (MIPS_CACHE_VIRTUAL_ALIAS) { |
458 | && (PG_MD_UNCACHED_P(md) | | 458 | if (PG_MD_CACHED_P(md) |
459 | || (pv->pv_pmap != NULL | | 459 | || (pv->pv_pmap != NULL |
460 | && mips_cache_badalias(pv->pv_va, va)))) { | | 460 | && mips_cache_badalias(pv->pv_va, va))) { |
461 | /* | | 461 | |
462 | * If this page was previously uncached or we had to use an | | 462 | /* |
463 | * incompatible alias and it has a valid mapping, flush it | | 463 | * If this page was previously cached or we had to use an |
464 | * from the cache. | | 464 | * incompatible alias and it has a valid mapping, flush it |
465 | */ | | 465 | * from the cache. |
466 | mips_dcache_wbinv_range(va, PAGE_SIZE); | | 466 | */ |
| | | 467 | mips_dcache_wbinv_range(va, PAGE_SIZE); |
| | | 468 | } |
467 | } | | 469 | } |
468 | PG_MD_PVLIST_UNLOCK(md); | | 470 | PG_MD_PVLIST_UNLOCK(md); |
469 | #ifndef _LP64 | | 471 | #ifndef _LP64 |
470 | /* | | 472 | /* |
471 | * If we had to map using a page table entry, unmap it now. | | 473 | * If we had to map using a page table entry, unmap it now. |
472 | */ | | 474 | */ |
473 | if (va >= VM_MIN_KERNEL_ADDRESS) { | | 475 | if (va >= VM_MIN_KERNEL_ADDRESS) { |
474 | pmap_kremove(va, PAGE_SIZE); | | 476 | pmap_kremove(va, PAGE_SIZE); |
475 | if (mips_pg_v(old_pt_entry.pt_entry)) { | | 477 | if (mips_pg_v(old_pt_entry.pt_entry)) { |
476 | *kvtopte(va) = old_pt_entry; | | 478 | *kvtopte(va) = old_pt_entry; |
477 | pmap_tlb_update_addr(pmap_kernel(), va, | | 479 | pmap_tlb_update_addr(pmap_kernel(), va, |
478 | old_pt_entry.pt_entry, false); | | 480 | old_pt_entry.pt_entry, false); |
479 | } | | 481 | } |