| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.347 2011/10/22 21:00:40 mrg Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.348 2012/01/29 11:49:58 para Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996 | | 4 | * Copyright (c) 1996 |
5 | * The President and Fellows of Harvard College. All rights reserved. | | 5 | * The President and Fellows of Harvard College. All rights reserved. |
6 | * Copyright (c) 1992, 1993 | | 6 | * Copyright (c) 1992, 1993 |
7 | * The Regents of the University of California. All rights reserved. | | 7 | * The Regents of the University of California. All rights reserved. |
8 | * | | 8 | * |
9 | * This software was developed by the Computer Systems Engineering group | | 9 | * This software was developed by the Computer Systems Engineering group |
10 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | | 10 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and |
11 | * contributed to Berkeley. | | 11 | * contributed to Berkeley. |
12 | * | | 12 | * |
13 | * All advertising materials mentioning features or use of this software | | 13 | * All advertising materials mentioning features or use of this software |
14 | * must display the following acknowledgement: | | 14 | * must display the following acknowledgement: |
| @@ -46,27 +46,27 @@ | | | @@ -46,27 +46,27 @@ |
46 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 46 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
47 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 47 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
48 | * SUCH DAMAGE. | | 48 | * SUCH DAMAGE. |
49 | * | | 49 | * |
50 | * @(#)pmap.c 8.4 (Berkeley) 2/5/94 | | 50 | * @(#)pmap.c 8.4 (Berkeley) 2/5/94 |
51 | * | | 51 | * |
52 | */ | | 52 | */ |
53 | | | 53 | |
54 | /* | | 54 | /* |
55 | * SPARC physical map management code. | | 55 | * SPARC physical map management code. |
56 | */ | | 56 | */ |
57 | | | 57 | |
58 | #include <sys/cdefs.h> | | 58 | #include <sys/cdefs.h> |
59 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.347 2011/10/22 21:00:40 mrg Exp $"); | | 59 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.348 2012/01/29 11:49:58 para Exp $"); |
60 | | | 60 | |
61 | #include "opt_ddb.h" | | 61 | #include "opt_ddb.h" |
62 | #include "opt_kgdb.h" | | 62 | #include "opt_kgdb.h" |
63 | #include "opt_sparc_arch.h" | | 63 | #include "opt_sparc_arch.h" |
64 | | | 64 | |
65 | #include <sys/param.h> | | 65 | #include <sys/param.h> |
66 | #include <sys/systm.h> | | 66 | #include <sys/systm.h> |
67 | #include <sys/device.h> | | 67 | #include <sys/device.h> |
68 | #include <sys/proc.h> | | 68 | #include <sys/proc.h> |
69 | #include <sys/queue.h> | | 69 | #include <sys/queue.h> |
70 | #include <sys/pool.h> | | 70 | #include <sys/pool.h> |
71 | #include <sys/exec.h> | | 71 | #include <sys/exec.h> |
72 | #include <sys/core.h> | | 72 | #include <sys/core.h> |
| @@ -870,27 +870,27 @@ setpte4m(vaddr_t va, int pte) | | | @@ -870,27 +870,27 @@ setpte4m(vaddr_t va, int pte) |
870 | void * | | 870 | void * |
871 | pgt_page_alloc(struct pool *pp, int flags) | | 871 | pgt_page_alloc(struct pool *pp, int flags) |
872 | { | | 872 | { |
873 | int cacheit = (cpuinfo.flags & CPUFLG_CACHEPAGETABLES) != 0; | | 873 | int cacheit = (cpuinfo.flags & CPUFLG_CACHEPAGETABLES) != 0; |
874 | struct vm_page *pg; | | 874 | struct vm_page *pg; |
875 | vaddr_t va; | | 875 | vaddr_t va; |
876 | paddr_t pa; | | 876 | paddr_t pa; |
877 | | | 877 | |
878 | /* Allocate a page of physical memory */ | | 878 | /* Allocate a page of physical memory */ |
879 | if ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL) | | 879 | if ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL) |
880 | return (NULL); | | 880 | return (NULL); |
881 | | | 881 | |
882 | /* Allocate virtual memory */ | | 882 | /* Allocate virtual memory */ |
883 | va = uvm_km_alloc(kmem_map, PAGE_SIZE, 0, UVM_KMF_VAONLY | | | 883 | va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_VAONLY | |
884 | ((flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK)); | | 884 | ((flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK)); |
885 | if (va == 0) { | | 885 | if (va == 0) { |
886 | uvm_pagefree(pg); | | 886 | uvm_pagefree(pg); |
887 | return (NULL); | | 887 | return (NULL); |
888 | } | | 888 | } |
889 | | | 889 | |
890 | /* | | 890 | /* |
891 | * On systems with a physical data cache we need to flush this page | | 891 | * On systems with a physical data cache we need to flush this page |
892 | * from the cache if the pagetables cannot be cached. | | 892 | * from the cache if the pagetables cannot be cached. |
893 | * On systems with a virtually indexed data cache, we only need | | 893 | * On systems with a virtually indexed data cache, we only need |
894 | * to map it non-cacheable, since the page is not currently mapped. | | 894 | * to map it non-cacheable, since the page is not currently mapped. |
895 | */ | | 895 | */ |
896 | pa = VM_PAGE_TO_PHYS(pg); | | 896 | pa = VM_PAGE_TO_PHYS(pg); |
| @@ -907,27 +907,27 @@ pgt_page_alloc(struct pool *pp, int flag | | | @@ -907,27 +907,27 @@ pgt_page_alloc(struct pool *pp, int flag |
907 | | | 907 | |
908 | void | | 908 | void |
909 | pgt_page_free(struct pool *pp, void *v) | | 909 | pgt_page_free(struct pool *pp, void *v) |
910 | { | | 910 | { |
911 | vaddr_t va; | | 911 | vaddr_t va; |
912 | paddr_t pa; | | 912 | paddr_t pa; |
913 | bool rv; | | 913 | bool rv; |
914 | | | 914 | |
915 | va = (vaddr_t)v; | | 915 | va = (vaddr_t)v; |
916 | rv = pmap_extract(pmap_kernel(), va, &pa); | | 916 | rv = pmap_extract(pmap_kernel(), va, &pa); |
917 | KASSERT(rv); | | 917 | KASSERT(rv); |
918 | uvm_pagefree(PHYS_TO_VM_PAGE(pa)); | | 918 | uvm_pagefree(PHYS_TO_VM_PAGE(pa)); |
919 | pmap_kremove(va, PAGE_SIZE); | | 919 | pmap_kremove(va, PAGE_SIZE); |
920 | uvm_km_free(kmem_map, va, PAGE_SIZE, UVM_KMF_VAONLY); | | 920 | uvm_km_free(kernel_map, va, PAGE_SIZE, UVM_KMF_VAONLY); |
921 | } | | 921 | } |
922 | #endif /* SUN4M || SUN4D */ | | 922 | #endif /* SUN4M || SUN4D */ |
923 | | | 923 | |
924 | /*----------------------------------------------------------------*/ | | 924 | /*----------------------------------------------------------------*/ |
925 | | | 925 | |
926 | /* | | 926 | /* |
927 | * The following three macros are to be used in sun4/sun4c code only. | | 927 | * The following three macros are to be used in sun4/sun4c code only. |
928 | */ | | 928 | */ |
929 | #if defined(SUN4_MMU3L) | | 929 | #if defined(SUN4_MMU3L) |
930 | #define CTX_USABLE(pm,rp) ( \ | | 930 | #define CTX_USABLE(pm,rp) ( \ |
931 | ((pm)->pm_ctx != NULL && \ | | 931 | ((pm)->pm_ctx != NULL && \ |
932 | (!HASSUN4_MMU3L || (rp)->rg_smeg != reginval)) \ | | 932 | (!HASSUN4_MMU3L || (rp)->rg_smeg != reginval)) \ |
933 | ) | | 933 | ) |