Fri Jan 25 13:17:40 2013 UTC ()
Shut up noisy debug unless pmap_debug_level > 0


(skrll)
diff -r1.64 -r1.65 src/sys/arch/arm/arm32/vm_machdep.c

cvs diff -r1.64 -r1.65 src/sys/arch/arm/arm32/vm_machdep.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm32/vm_machdep.c 2012/12/18 06:30:18 1.64
+++ src/sys/arch/arm/arm32/vm_machdep.c 2013/01/25 13:17:39 1.65
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vm_machdep.c,v 1.64 2012/12/18 06:30:18 matt Exp $ */ 1/* $NetBSD: vm_machdep.c,v 1.65 2013/01/25 13:17:39 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994-1998 Mark Brinicombe. 4 * Copyright (c) 1994-1998 Mark Brinicombe.
5 * Copyright (c) 1994 Brini. 5 * Copyright (c) 1994 Brini.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software written for Brini by Mark Brinicombe 8 * This code is derived from software written for Brini by Mark Brinicombe
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -34,27 +34,27 @@ @@ -34,27 +34,27 @@
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE. 35 * SUCH DAMAGE.
36 * 36 *
37 * RiscBSD kernel project 37 * RiscBSD kernel project
38 * 38 *
39 * vm_machdep.h 39 * vm_machdep.h
40 * 40 *
41 * vm machine specific bits 41 * vm machine specific bits
42 * 42 *
43 * Created : 08/10/94 43 * Created : 08/10/94
44 */ 44 */
45 45
46#include <sys/cdefs.h> 46#include <sys/cdefs.h>
47__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.64 2012/12/18 06:30:18 matt Exp $"); 47__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.65 2013/01/25 13:17:39 skrll Exp $");
48 48
49#include "opt_armfpe.h" 49#include "opt_armfpe.h"
50#include "opt_pmap_debug.h" 50#include "opt_pmap_debug.h"
51#include "opt_perfctrs.h" 51#include "opt_perfctrs.h"
52#include "opt_cputypes.h" 52#include "opt_cputypes.h"
53 53
54#include <sys/param.h> 54#include <sys/param.h>
55#include <sys/systm.h> 55#include <sys/systm.h>
56#include <sys/proc.h> 56#include <sys/proc.h>
57#include <sys/malloc.h> 57#include <sys/malloc.h>
58#include <sys/vnode.h> 58#include <sys/vnode.h>
59#include <sys/cpu.h> 59#include <sys/cpu.h>
60#include <sys/buf.h> 60#include <sys/buf.h>
@@ -108,27 +108,27 @@ cpu_proc_fork(struct proc *p1, struct pr @@ -108,27 +108,27 @@ cpu_proc_fork(struct proc *p1, struct pr
108 * accordingly. 108 * accordingly.
109 */ 109 */
110void 110void
111cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, 111cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
112 void (*func)(void *), void *arg) 112 void (*func)(void *), void *arg)
113{ 113{
114 struct switchframe *sf; 114 struct switchframe *sf;
115 vaddr_t uv; 115 vaddr_t uv;
116 116
117 const struct pcb * const pcb1 = lwp_getpcb(l1); 117 const struct pcb * const pcb1 = lwp_getpcb(l1);
118 struct pcb * const pcb2 = lwp_getpcb(l2); 118 struct pcb * const pcb2 = lwp_getpcb(l2);
119 119
120#ifdef PMAP_DEBUG 120#ifdef PMAP_DEBUG
121 if (pmap_debug_level >= 0) 121 if (pmap_debug_level > 0)
122 printf("cpu_lwp_fork: %p %p %p %p\n", l1, l2, curlwp, &lwp0); 122 printf("cpu_lwp_fork: %p %p %p %p\n", l1, l2, curlwp, &lwp0);
123#endif /* PMAP_DEBUG */ 123#endif /* PMAP_DEBUG */
124 124
125 /* Copy the pcb */ 125 /* Copy the pcb */
126 *pcb2 = *pcb1; 126 *pcb2 = *pcb1;
127 127
128#ifdef FPU_VFP 128#ifdef FPU_VFP
129 /* 129 /*
130 * Disable the VFP for a newly created LWP but remember if the 130 * Disable the VFP for a newly created LWP but remember if the
131 * VFP state is valid. 131 * VFP state is valid.
132 */ 132 */
133 pcb2->pcb_vfp.vfp_fpexc &= ~VFP_FPEXC_EN; 133 pcb2->pcb_vfp.vfp_fpexc &= ~VFP_FPEXC_EN;
134 l2->l_md.md_flags = l1->l_md.md_flags & MDLWP_VFPUSED; 134 l2->l_md.md_flags = l1->l_md.md_flags & MDLWP_VFPUSED;
@@ -138,27 +138,27 @@ cpu_lwp_fork(struct lwp *l1, struct lwp  @@ -138,27 +138,27 @@ cpu_lwp_fork(struct lwp *l1, struct lwp
138 * Set up the kernel stack for the process. 138 * Set up the kernel stack for the process.
139 * Note: this stack is not in use if we are forking from p1 139 * Note: this stack is not in use if we are forking from p1
140 */ 140 */
141 uv = uvm_lwp_getuarea(l2); 141 uv = uvm_lwp_getuarea(l2);
142 pcb2->pcb_ksp = uv + USPACE_SVC_STACK_TOP; 142 pcb2->pcb_ksp = uv + USPACE_SVC_STACK_TOP;
143 143
144#ifdef STACKCHECKS 144#ifdef STACKCHECKS
145 /* Fill the kernel stack with a known pattern */ 145 /* Fill the kernel stack with a known pattern */
146 memset((void *)(uv + USPACE_SVC_STACK_BOTTOM), 0xdd, 146 memset((void *)(uv + USPACE_SVC_STACK_BOTTOM), 0xdd,
147 (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM)); 147 (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM));
148#endif /* STACKCHECKS */ 148#endif /* STACKCHECKS */
149 149
150#ifdef PMAP_DEBUG 150#ifdef PMAP_DEBUG
151 if (pmap_debug_level >= 0) { 151 if (pmap_debug_level > 0) {
152 printf("l1: pcb=%p pid=%d pmap=%p\n", 152 printf("l1: pcb=%p pid=%d pmap=%p\n",
153 pcb1, l1->l_lid, l1->l_proc->p_vmspace->vm_map.pmap); 153 pcb1, l1->l_lid, l1->l_proc->p_vmspace->vm_map.pmap);
154 printf("l2: pcb=%p pid=%d pmap=%p\n", 154 printf("l2: pcb=%p pid=%d pmap=%p\n",
155 pcb2, l2->l_lid, l2->l_proc->p_vmspace->vm_map.pmap); 155 pcb2, l2->l_lid, l2->l_proc->p_vmspace->vm_map.pmap);
156 } 156 }
157#endif /* PMAP_DEBUG */ 157#endif /* PMAP_DEBUG */
158 158
159 struct trapframe *tf = (struct trapframe *)pcb2->pcb_ksp - 1; 159 struct trapframe *tf = (struct trapframe *)pcb2->pcb_ksp - 1;
160 lwp_settrapframe(l2, tf); 160 lwp_settrapframe(l2, tf);
161 *tf = *lwp_trapframe(l1); 161 *tf = *lwp_trapframe(l1);
162 162
163 /* 163 /*
164 * If specified, give the child a different stack (make sure 164 * If specified, give the child a different stack (make sure
@@ -208,27 +208,27 @@ cpu_lwp_free2(struct lwp *l) @@ -208,27 +208,27 @@ cpu_lwp_free2(struct lwp *l)
208/* 208/*
209 * Map a user I/O request into kernel virtual address space. 209 * Map a user I/O request into kernel virtual address space.
210 * Note: the pages are already locked by uvm_vslock(), so we 210 * Note: the pages are already locked by uvm_vslock(), so we
211 * do not need to pass an access_type to pmap_enter(). 211 * do not need to pass an access_type to pmap_enter().
212 */ 212 */
213int 213int
214vmapbuf(struct buf *bp, vsize_t len) 214vmapbuf(struct buf *bp, vsize_t len)
215{ 215{
216 vaddr_t faddr, taddr, off; 216 vaddr_t faddr, taddr, off;
217 paddr_t fpa; 217 paddr_t fpa;
218 218
219 219
220#ifdef PMAP_DEBUG 220#ifdef PMAP_DEBUG
221 if (pmap_debug_level >= 0) 221 if (pmap_debug_level > 0)
222 printf("vmapbuf: bp=%08x buf=%08x len=%08x\n", (u_int)bp, 222 printf("vmapbuf: bp=%08x buf=%08x len=%08x\n", (u_int)bp,
223 (u_int)bp->b_data, (u_int)len); 223 (u_int)bp->b_data, (u_int)len);
224#endif /* PMAP_DEBUG */ 224#endif /* PMAP_DEBUG */
225  225
226 if ((bp->b_flags & B_PHYS) == 0) 226 if ((bp->b_flags & B_PHYS) == 0)
227 panic("vmapbuf"); 227 panic("vmapbuf");
228 228
229 bp->b_saveaddr = bp->b_data; 229 bp->b_saveaddr = bp->b_data;
230 faddr = trunc_page((vaddr_t)bp->b_data); 230 faddr = trunc_page((vaddr_t)bp->b_data);
231 off = (vaddr_t)bp->b_data - faddr; 231 off = (vaddr_t)bp->b_data - faddr;
232 len = round_page(off + len); 232 len = round_page(off + len);
233 taddr = uvm_km_alloc(phys_map, len, atop(faddr) & uvmexp.colormask, 233 taddr = uvm_km_alloc(phys_map, len, atop(faddr) & uvmexp.colormask,
234 UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_COLORMATCH); 234 UVM_KMF_VAONLY | UVM_KMF_WAITVA | UVM_KMF_COLORMATCH);
@@ -251,27 +251,27 @@ vmapbuf(struct buf *bp, vsize_t len) @@ -251,27 +251,27 @@ vmapbuf(struct buf *bp, vsize_t len)
251 251
252 return 0; 252 return 0;
253} 253}
254 254
255/* 255/*
256 * Unmap a previously-mapped user I/O request. 256 * Unmap a previously-mapped user I/O request.
257 */ 257 */
258void 258void
259vunmapbuf(struct buf *bp, vsize_t len) 259vunmapbuf(struct buf *bp, vsize_t len)
260{ 260{
261 vaddr_t addr, off; 261 vaddr_t addr, off;
262 262
263#ifdef PMAP_DEBUG 263#ifdef PMAP_DEBUG
264 if (pmap_debug_level >= 0) 264 if (pmap_debug_level > 0)
265 printf("vunmapbuf: bp=%08x buf=%08x len=%08x\n", 265 printf("vunmapbuf: bp=%08x buf=%08x len=%08x\n",
266 (u_int)bp, (u_int)bp->b_data, (u_int)len); 266 (u_int)bp, (u_int)bp->b_data, (u_int)len);
267#endif /* PMAP_DEBUG */ 267#endif /* PMAP_DEBUG */
268 268
269 if ((bp->b_flags & B_PHYS) == 0) 269 if ((bp->b_flags & B_PHYS) == 0)
270 panic("vunmapbuf"); 270 panic("vunmapbuf");
271 271
272 /* 272 /*
273 * Make sure the cache does not have dirty data for the 273 * Make sure the cache does not have dirty data for the
274 * pages we had mapped. 274 * pages we had mapped.
275 */ 275 */
276 addr = trunc_page((vaddr_t)bp->b_data); 276 addr = trunc_page((vaddr_t)bp->b_data);
277 off = (vaddr_t)bp->b_data - addr; 277 off = (vaddr_t)bp->b_data - addr;