| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.267 2010/11/02 12:21:07 uebayasi Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.268 2010/11/02 13:09:29 uebayasi Exp $ */ |
2 | /* | | 2 | /* |
3 | * | | 3 | * |
4 | * Copyright (C) 1996-1999 Eduardo Horvath. | | 4 | * Copyright (C) 1996-1999 Eduardo Horvath. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * | | 13 | * |
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND | | 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE | | 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
24 | * SUCH DAMAGE. | | 24 | * SUCH DAMAGE. |
25 | * | | 25 | * |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2010/11/02 12:21:07 uebayasi Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.268 2010/11/02 13:09:29 uebayasi Exp $"); |
30 | | | 30 | |
31 | #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ | | 31 | #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ |
32 | #define HWREF | | 32 | #define HWREF |
33 | | | 33 | |
34 | #include "opt_ddb.h" | | 34 | #include "opt_ddb.h" |
35 | #include "opt_multiprocessor.h" | | 35 | #include "opt_multiprocessor.h" |
36 | | | 36 | |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/malloc.h> | | 38 | #include <sys/malloc.h> |
39 | #include <sys/queue.h> | | 39 | #include <sys/queue.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/msgbuf.h> | | 41 | #include <sys/msgbuf.h> |
42 | #include <sys/pool.h> | | 42 | #include <sys/pool.h> |
| @@ -1436,27 +1436,29 @@ pmap_destroy(struct pmap *pm) | | | @@ -1436,27 +1436,29 @@ pmap_destroy(struct pmap *pm) |
1436 | } | | 1436 | } |
1437 | mutex_exit(&ci->ci_ctx_lock); | | 1437 | mutex_exit(&ci->ci_ctx_lock); |
1438 | } | | 1438 | } |
1439 | #else | | 1439 | #else |
1440 | if (pmap_ctx(pm)) { | | 1440 | if (pmap_ctx(pm)) { |
1441 | mutex_enter(&curcpu()->ci_ctx_lock); | | 1441 | mutex_enter(&curcpu()->ci_ctx_lock); |
1442 | ctx_free(pm, curcpu()); | | 1442 | ctx_free(pm, curcpu()); |
1443 | mutex_exit(&curcpu()->ci_ctx_lock); | | 1443 | mutex_exit(&curcpu()->ci_ctx_lock); |
1444 | } | | 1444 | } |
1445 | #endif | | 1445 | #endif |
1446 | | | 1446 | |
1447 | /* we could be a little smarter and leave pages zeroed */ | | 1447 | /* we could be a little smarter and leave pages zeroed */ |
1448 | for (pg = TAILQ_FIRST(&pm->pm_obj.memq); pg != NULL; pg = nextpg) { | | 1448 | for (pg = TAILQ_FIRST(&pm->pm_obj.memq); pg != NULL; pg = nextpg) { |
| | | 1449 | #ifdef DIAGNOSTIC |
1449 | struct vm_page_md *md = VM_PAGE_TO_MD(pg); | | 1450 | struct vm_page_md *md = VM_PAGE_TO_MD(pg); |
| | | 1451 | #endif |
1450 | | | 1452 | |
1451 | KASSERT((pg->flags & PG_MARKER) == 0); | | 1453 | KASSERT((pg->flags & PG_MARKER) == 0); |
1452 | nextpg = TAILQ_NEXT(pg, listq.queue); | | 1454 | nextpg = TAILQ_NEXT(pg, listq.queue); |
1453 | TAILQ_REMOVE(&pm->pm_obj.memq, pg, listq.queue); | | 1455 | TAILQ_REMOVE(&pm->pm_obj.memq, pg, listq.queue); |
1454 | KASSERT(md->mdpg_pvh.pv_pmap == NULL); | | 1456 | KASSERT(md->mdpg_pvh.pv_pmap == NULL); |
1455 | dcache_flush_page_cpuset(VM_PAGE_TO_PHYS(pg), pmap_cpus_active); | | 1457 | dcache_flush_page_cpuset(VM_PAGE_TO_PHYS(pg), pmap_cpus_active); |
1456 | uvm_pagefree(pg); | | 1458 | uvm_pagefree(pg); |
1457 | } | | 1459 | } |
1458 | pmap_free_page((paddr_t)(u_long)pm->pm_segs, pmap_cpus_active); | | 1460 | pmap_free_page((paddr_t)(u_long)pm->pm_segs, pmap_cpus_active); |
1459 | UVM_OBJ_DESTROY(&pm->pm_obj); | | 1461 | UVM_OBJ_DESTROY(&pm->pm_obj); |
1460 | pool_cache_put(&pmap_cache, pm); | | 1462 | pool_cache_put(&pmap_cache, pm); |
1461 | } | | 1463 | } |
1462 | | | 1464 | |