Mon Dec 14 12:53:18 2009 UTC ()
We don't declare variables in for () statement.


(uebayasi)
diff -r1.18 -r1.19 src/sys/arch/mips/mips/compat_13_machdep.c
diff -r1.15 -r1.16 src/sys/arch/mips/mips/compat_16_machdep.c

cvs diff -r1.18 -r1.19 src/sys/arch/mips/mips/compat_13_machdep.c (expand / switch to unified diff)

--- src/sys/arch/mips/mips/compat_13_machdep.c 2009/12/14 00:46:05 1.18
+++ src/sys/arch/mips/mips/compat_13_machdep.c 2009/12/14 12:53:18 1.19
@@ -1,31 +1,31 @@ @@ -1,31 +1,31 @@
1/* $NetBSD: compat_13_machdep.c,v 1.18 2009/12/14 00:46:05 matt Exp $ */ 1/* $NetBSD: compat_13_machdep.c,v 1.19 2009/12/14 12:53:18 uebayasi Exp $ */
2 2
3/* 3/*
4 * Copyright 1996 The Board of Trustees of The Leland Stanford 4 * Copyright 1996 The Board of Trustees of The Leland Stanford
5 * Junior University. All Rights Reserved. 5 * Junior University. All Rights Reserved.
6 * 6 *
7 * Permission to use, copy, modify, and distribute this 7 * Permission to use, copy, modify, and distribute this
8 * software and its documentation for any purpose and without 8 * software and its documentation for any purpose and without
9 * fee is hereby granted, provided that the above copyright 9 * fee is hereby granted, provided that the above copyright
10 * notice appear in all copies. Stanford University 10 * notice appear in all copies. Stanford University
11 * makes no representations about the suitability of this 11 * makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without 12 * software for any purpose. It is provided "as is" without
13 * express or implied warranty. 13 * express or implied warranty.
14 */ 14 */
15 15
16#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 16#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
17 17
18__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.18 2009/12/14 00:46:05 matt Exp $"); 18__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.19 2009/12/14 12:53:18 uebayasi Exp $");
19 19
20#include <sys/param.h> 20#include <sys/param.h>
21#include <sys/systm.h> 21#include <sys/systm.h>
22#include <sys/signalvar.h> 22#include <sys/signalvar.h>
23#include <sys/kernel.h> 23#include <sys/kernel.h>
24#include <sys/proc.h> 24#include <sys/proc.h>
25#include <sys/mount.h> 25#include <sys/mount.h>
26#include <sys/syscallargs.h> 26#include <sys/syscallargs.h>
27 27
28#include <compat/sys/signal.h> 28#include <compat/sys/signal.h>
29#include <compat/sys/signalvar.h> 29#include <compat/sys/signalvar.h>
30 30
31#include <mips/regnum.h> 31#include <mips/regnum.h>
@@ -74,27 +74,28 @@ compat_13_sys_sigreturn(struct lwp *l, c @@ -74,27 +74,28 @@ compat_13_sys_sigreturn(struct lwp *l, c
74 74
75 if ((uint32_t)ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */ 75 if ((uint32_t)ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */
76 return (EINVAL); 76 return (EINVAL);
77 77
78 /* Resture the register context. */ 78 /* Resture the register context. */
79 f = l->l_md.md_regs; 79 f = l->l_md.md_regs;
80 f->f_regs[_R_PC] = ksc.sc_pc; 80 f->f_regs[_R_PC] = ksc.sc_pc;
81 f->f_regs[_R_MULLO] = ksc.mullo; 81 f->f_regs[_R_MULLO] = ksc.mullo;
82 f->f_regs[_R_MULHI] = ksc.mulhi; 82 f->f_regs[_R_MULHI] = ksc.mulhi;
83#if defined(__mips_o32) 83#if defined(__mips_o32)
84 memcpy(&f->f_regs[1], &scp->sc_regs[1], 84 memcpy(&f->f_regs[1], &scp->sc_regs[1],
85 sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0])); 85 sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0]));
86#else 86#else
87 for (size_t i = 1; i < __arraycount(scp->sc_regs); i++) 87 size_t i;
 88 for (i = 1; i < __arraycount(scp->sc_regs); i++)
88 f->f_regs[i] = scp->sc_regs[i]; 89 f->f_regs[i] = scp->sc_regs[i];
89#endif 90#endif
90 if (scp->sc_fpused) { 91 if (scp->sc_fpused) {
91 struct pcb * const pcb = lwp_getpcb(l); 92 struct pcb * const pcb = lwp_getpcb(l);
92 *(struct fpreg *)&pcb->pcb_fpregs = *(struct fpreg *)scp->sc_fpregs; 93 *(struct fpreg *)&pcb->pcb_fpregs = *(struct fpreg *)scp->sc_fpregs;
93 } 94 }
94 95
95 mutex_enter(p->p_lock); 96 mutex_enter(p->p_lock);
96 97
97 /* Restore signal stack. */ 98 /* Restore signal stack. */
98 if (ksc.sc_onstack & SS_ONSTACK) 99 if (ksc.sc_onstack & SS_ONSTACK)
99 l->l_sigstk.ss_flags |= SS_ONSTACK; 100 l->l_sigstk.ss_flags |= SS_ONSTACK;
100 else 101 else

cvs diff -r1.15 -r1.16 src/sys/arch/mips/mips/compat_16_machdep.c (expand / switch to unified diff)

--- src/sys/arch/mips/mips/compat_16_machdep.c 2009/12/14 00:46:05 1.15
+++ src/sys/arch/mips/mips/compat_16_machdep.c 2009/12/14 12:53:18 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: compat_16_machdep.c,v 1.15 2009/12/14 00:46:05 matt Exp $ */ 1/* $NetBSD: compat_16_machdep.c,v 1.16 2009/12/14 12:53:18 uebayasi 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 Demetriou. 9 * NASA Ames Research Center and by Chris 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
@@ -35,27 +35,27 @@ @@ -35,27 +35,27 @@
35 * Junior University. All Rights Reserved. 35 * Junior University. All Rights Reserved.
36 * 36 *
37 * Permission to use, copy, modify, and distribute this 37 * Permission to use, copy, modify, and distribute this
38 * software and its documentation for any purpose and without 38 * software and its documentation for any purpose and without
39 * fee is hereby granted, provided that the above copyright 39 * fee is hereby granted, provided that the above copyright
40 * notice appear in all copies. Stanford University 40 * notice appear in all copies. Stanford University
41 * makes no representations about the suitability of this 41 * makes no representations about the suitability of this
42 * software for any purpose. It is provided "as is" without 42 * software for any purpose. It is provided "as is" without
43 * express or implied warranty. 43 * express or implied warranty.
44 */ 44 */
45 45
46#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 46#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
47  47
48__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.15 2009/12/14 00:46:05 matt Exp $");  48__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.16 2009/12/14 12:53:18 uebayasi Exp $");
49 49
50#ifdef _KERNEL_OPT 50#ifdef _KERNEL_OPT
51#include "opt_cputype.h" 51#include "opt_cputype.h"
52#include "opt_compat_netbsd.h" 52#include "opt_compat_netbsd.h"
53#include "opt_compat_ultrix.h" 53#include "opt_compat_ultrix.h"
54#endif 54#endif
55 55
56#include <sys/param.h> 56#include <sys/param.h>
57#include <sys/systm.h> 57#include <sys/systm.h>
58#include <sys/kernel.h> 58#include <sys/kernel.h>
59#include <sys/proc.h> 59#include <sys/proc.h>
60#include <sys/signal.h> 60#include <sys/signal.h>
61#include <sys/signalvar.h> 61#include <sys/signalvar.h>
@@ -115,27 +115,28 @@ sendsig_sigcontext(const ksiginfo_t *ksi @@ -115,27 +115,28 @@ sendsig_sigcontext(const ksiginfo_t *ksi
115#endif 115#endif
116 116
117 /* Build stack frame for signal trampoline. */ 117 /* Build stack frame for signal trampoline. */
118 ksc.sc_pc = f->f_regs[_R_PC]; 118 ksc.sc_pc = f->f_regs[_R_PC];
119 ksc.mullo = f->f_regs[_R_MULLO]; 119 ksc.mullo = f->f_regs[_R_MULLO];
120 ksc.mulhi = f->f_regs[_R_MULHI]; 120 ksc.mulhi = f->f_regs[_R_MULHI];
121 121
122 /* Save register context. */ 122 /* Save register context. */
123 ksc.sc_regs[_R_ZERO] = 0xACEDBADE; /* magic number */ 123 ksc.sc_regs[_R_ZERO] = 0xACEDBADE; /* magic number */
124#if defined(__mips_o32) 124#if defined(__mips_o32)
125 memcpy(&ksc.sc_regs[1], &f->f_regs[1], 125 memcpy(&ksc.sc_regs[1], &f->f_regs[1],
126 sizeof(ksc.sc_regs) - sizeof(ksc.sc_regs[0])); 126 sizeof(ksc.sc_regs) - sizeof(ksc.sc_regs[0]));
127#else 127#else
128 for (size_t i = 1; i < 32; i++) 128 size_t i;
 129 for (i = 1; i < 32; i++)
129 ksc.sc_regs[i] = f->f_regs[i]; 130 ksc.sc_regs[i] = f->f_regs[i];
130#endif 131#endif
131 132
132 /* Save the FP state, if necessary, then copy it. */ 133 /* Save the FP state, if necessary, then copy it. */
133 pcb = lwp_getpcb(l); 134 pcb = lwp_getpcb(l);
134#ifndef SOFTFLOAT 135#ifndef SOFTFLOAT
135 ksc.sc_fpused = l->l_md.md_flags & MDP_FPUSED; 136 ksc.sc_fpused = l->l_md.md_flags & MDP_FPUSED;
136 if (ksc.sc_fpused) { 137 if (ksc.sc_fpused) {
137 /* if FPU has current state, save it first */ 138 /* if FPU has current state, save it first */
138 savefpregs(l); 139 savefpregs(l);
139 } 140 }
140#endif 141#endif
141 *(struct fpreg *)ksc.sc_fpregs = *(struct fpreg *)&pcb->pcb_fpregs; 142 *(struct fpreg *)ksc.sc_fpregs = *(struct fpreg *)&pcb->pcb_fpregs;
@@ -262,27 +263,28 @@ compat_16_sys___sigreturn14(struct lwp * @@ -262,27 +263,28 @@ compat_16_sys___sigreturn14(struct lwp *
262 if ((u_int) ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */ 263 if ((u_int) ksc.sc_regs[_R_ZERO] != 0xacedbadeU)/* magic number */
263 return (EINVAL); 264 return (EINVAL);
264 265
265 /* Restore the register context. */ 266 /* Restore the register context. */
266 f = l->l_md.md_regs; 267 f = l->l_md.md_regs;
267 f->f_regs[_R_PC] = ksc.sc_pc; 268 f->f_regs[_R_PC] = ksc.sc_pc;
268 f->f_regs[_R_MULLO] = ksc.mullo; 269 f->f_regs[_R_MULLO] = ksc.mullo;
269 f->f_regs[_R_MULHI] = ksc.mulhi; 270 f->f_regs[_R_MULHI] = ksc.mulhi;
270#if defined(__mips_o32) 271#if defined(__mips_o32)
271 memcpy(&f->f_regs[1], &scp->sc_regs[1], 272 memcpy(&f->f_regs[1], &scp->sc_regs[1],
272 sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0])); 273 sizeof(scp->sc_regs) - sizeof(scp->sc_regs[0]));
273 274
274#else 275#else
275 for (size_t i = 1; i < __arraycount(f->f_regs); i++) 276 size_t i;
 277 for (i = 1; i < __arraycount(f->f_regs); i++)
276 f->f_regs[i] = ksc.sc_regs[i]; 278 f->f_regs[i] = ksc.sc_regs[i];
277#endif 279#endif
278#ifndef SOFTFLOAT 280#ifndef SOFTFLOAT
279 if (scp->sc_fpused) { 281 if (scp->sc_fpused) {
280 /* Disable the FPU to fault in FP registers. */ 282 /* Disable the FPU to fault in FP registers. */
281 f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT; 283 f->f_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;
282 fpcurlwp = &lwp0; 284 fpcurlwp = &lwp0;
283 } 285 }
284#endif 286#endif
285 pcb = lwp_getpcb(l); 287 pcb = lwp_getpcb(l);
286 *(struct fpreg *)&pcb->pcb_fpregs = *(struct fpreg *)scp->sc_fpregs; 288 *(struct fpreg *)&pcb->pcb_fpregs = *(struct fpreg *)scp->sc_fpregs;
287 289
288 mutex_enter(p->p_lock); 290 mutex_enter(p->p_lock);