| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.4 2014/02/25 15:20:29 martin Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.5 2014/12/19 04:25:52 nonaka 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.4 2014/02/25 15:20:29 martin Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.5 2014/12/19 04:25:52 nonaka 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, |
| @@ -501,26 +501,31 @@ pmap_create(void) | | | @@ -501,26 +501,31 @@ pmap_create(void) |
501 | PMAP_COUNT(create); | | 501 | PMAP_COUNT(create); |
502 | | | 502 | |
503 | pmap = pool_get(&pmap_pmap_pool, PR_WAITOK); | | 503 | pmap = pool_get(&pmap_pmap_pool, PR_WAITOK); |
504 | memset(pmap, 0, PMAP_SIZE); | | 504 | memset(pmap, 0, PMAP_SIZE); |
505 | | | 505 | |
506 | KASSERT(pmap->pm_pai[0].pai_link.le_prev == NULL); | | 506 | KASSERT(pmap->pm_pai[0].pai_link.le_prev == NULL); |
507 | | | 507 | |
508 | pmap->pm_count = 1; | | 508 | pmap->pm_count = 1; |
509 | pmap->pm_minaddr = VM_MIN_ADDRESS; | | 509 | pmap->pm_minaddr = VM_MIN_ADDRESS; |
510 | pmap->pm_maxaddr = VM_MAXUSER_ADDRESS; | | 510 | pmap->pm_maxaddr = VM_MAXUSER_ADDRESS; |
511 | | | 511 | |
512 | pmap_segtab_init(pmap); | | 512 | pmap_segtab_init(pmap); |
513 | | | 513 | |
| | | 514 | #ifdef MULTIPROCESSOR |
| | | 515 | kcpuset_create(&pmap->pm_active, true); |
| | | 516 | kcpuset_create(&pmap->pm_onproc, true); |
| | | 517 | #endif |
| | | 518 | |
514 | UVMHIST_LOG(pmaphist, "<- pmap %p", pmap,0,0,0); | | 519 | UVMHIST_LOG(pmaphist, "<- pmap %p", pmap,0,0,0); |
515 | return pmap; | | 520 | return pmap; |
516 | } | | 521 | } |
517 | | | 522 | |
518 | /* | | 523 | /* |
519 | * Retire the given physical map from service. | | 524 | * Retire the given physical map from service. |
520 | * Should only be called if the map contains | | 525 | * Should only be called if the map contains |
521 | * no valid mappings. | | 526 | * no valid mappings. |
522 | */ | | 527 | */ |
523 | void | | 528 | void |
524 | pmap_destroy(pmap_t pmap) | | 529 | pmap_destroy(pmap_t pmap) |
525 | { | | 530 | { |
526 | UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); | | 531 | UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); |