Sat Aug 27 20:49:36 2011 UTC ()
CPU_DEBUG: remove printf in cpu_signotify, and print pid/lid in cpu_switchto


(jmcneill)
diff -r1.16 -r1.17 src/sys/arch/usermode/dev/cpu.c

cvs diff -r1.16 -r1.17 src/sys/arch/usermode/dev/cpu.c (expand / switch to unified diff)

--- src/sys/arch/usermode/dev/cpu.c 2011/08/24 19:55:35 1.16
+++ src/sys/arch/usermode/dev/cpu.c 2011/08/27 20:49:36 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $ */ 1/* $NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17 2011/08/27 20:49:36 jmcneill Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/conf.h> 33#include <sys/conf.h>
34#include <sys/proc.h> 34#include <sys/proc.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/reboot.h> 37#include <sys/reboot.h>
38#include <sys/lwp.h> 38#include <sys/lwp.h>
39#include <sys/cpu.h> 39#include <sys/cpu.h>
40#include <sys/mbuf.h> 40#include <sys/mbuf.h>
41#include <sys/msgbuf.h> 41#include <sys/msgbuf.h>
42 42
43#include <dev/cons.h> 43#include <dev/cons.h>
@@ -146,29 +146,33 @@ void @@ -146,29 +146,33 @@ void
146cpu_need_proftick(struct lwp *l) 146cpu_need_proftick(struct lwp *l)
147{ 147{
148} 148}
149 149
150lwp_t * 150lwp_t *
151cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning) 151cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning)
152{ 152{
153 extern int errno; 153 extern int errno;
154 struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; 154 struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL;
155 struct pcb *newpcb = lwp_getpcb(newlwp); 155 struct pcb *newpcb = lwp_getpcb(newlwp);
156 struct cpu_info *ci = curcpu(); 156 struct cpu_info *ci = curcpu();
157 157
158#ifdef CPU_DEBUG 158#ifdef CPU_DEBUG
159 printf("cpu_switchto [%s] -> [%s]\n", 159 printf("cpu_switchto [%s,pid=%d,lid=%d] -> [%s,pid=%d,lid=%d]\n",
160 oldlwp ? oldlwp->l_name : "none", 160 oldlwp ? oldlwp->l_name : "none",
161 newlwp ? newlwp->l_name : "none"); 161 oldlwp ? oldlwp->l_proc->p_pid : -1,
 162 oldlwp ? oldlwp->l_lid : -1,
 163 newlwp ? newlwp->l_name : "none",
 164 newlwp ? newlwp->l_proc->p_pid : -1,
 165 newlwp ? newlwp->l_lid : -1);
162 if (oldpcb) { 166 if (oldpcb) {
163 printf(" oldpcb uc_link=%p, uc_stack.ss_sp=%p, " 167 printf(" oldpcb uc_link=%p, uc_stack.ss_sp=%p, "
164 "uc_stack.ss_size=%d\n", 168 "uc_stack.ss_size=%d\n",
165 oldpcb->pcb_ucp.uc_link, 169 oldpcb->pcb_ucp.uc_link,
166 oldpcb->pcb_ucp.uc_stack.ss_sp, 170 oldpcb->pcb_ucp.uc_stack.ss_sp,
167 (int)oldpcb->pcb_ucp.uc_stack.ss_size); 171 (int)oldpcb->pcb_ucp.uc_stack.ss_size);
168 } 172 }
169 if (newpcb) { 173 if (newpcb) {
170 printf(" newpcb uc_link=%p, uc_stack.ss_sp=%p, " 174 printf(" newpcb uc_link=%p, uc_stack.ss_sp=%p, "
171 "uc_stack.ss_size=%d\n", 175 "uc_stack.ss_size=%d\n",
172 newpcb->pcb_ucp.uc_link, 176 newpcb->pcb_ucp.uc_link,
173 newpcb->pcb_ucp.uc_stack.ss_sp, 177 newpcb->pcb_ucp.uc_stack.ss_sp,
174 (int)newpcb->pcb_ucp.uc_stack.ss_size); 178 (int)newpcb->pcb_ucp.uc_stack.ss_size);
@@ -192,29 +196,26 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw @@ -192,29 +196,26 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
192} 196}
193 197
194void 198void
195cpu_dumpconf(void) 199cpu_dumpconf(void)
196{ 200{
197#ifdef CPU_DEBUG 201#ifdef CPU_DEBUG
198 printf("cpu_dumpconf\n"); 202 printf("cpu_dumpconf\n");
199#endif 203#endif
200} 204}
201 205
202void 206void
203cpu_signotify(struct lwp *l) 207cpu_signotify(struct lwp *l)
204{ 208{
205#ifdef CPU_DEBUG 
206 printf("cpu_signotify\n"); 
207#endif 
208} 209}
209 210
210void 211void
211cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) 212cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
212{ 213{
213#ifdef CPU_DEBUG 214#ifdef CPU_DEBUG
214 printf("cpu_getmcontext\n"); 215 printf("cpu_getmcontext\n");
215#endif 216#endif
216} 217}
217 218
218int 219int
219cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) 220cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
220{ 221{