Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 GC garbage in userret() and *_syscall().
details: https://anonhg.NetBSD.org/src/rev/16b94e20c6bb
branches: trunk
changeset: 500274:16b94e20c6bb
user: mycroft <mycroft%NetBSD.org@localhost>
date: Sat Dec 09 06:34:07 2000 +0000
description:
GC garbage in userret() and *_syscall().
diffstat:
sys/arch/i386/i386/ibcs2_syscall.c | 34 +++++++++-------------------------
sys/arch/i386/i386/linux_syscall.c | 36 ++++++++----------------------------
2 files changed, 17 insertions(+), 53 deletions(-)
diffs (202 lines):
diff -r 31687cfc0467 -r 16b94e20c6bb sys/arch/i386/i386/ibcs2_syscall.c
--- a/sys/arch/i386/i386/ibcs2_syscall.c Sat Dec 09 06:33:15 2000 +0000
+++ b/sys/arch/i386/i386/ibcs2_syscall.c Sat Dec 09 06:34:07 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ibcs2_syscall.c,v 1.1 2000/12/02 16:03:24 jdolecek Exp $ */
+/* $NetBSD: ibcs2_syscall.c,v 1.2 2000/12/09 06:34:07 mycroft Exp $ */
/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -125,18 +125,9 @@
{
int sig;
- /* take pending signals */
+ /* Take pending signals. */
while ((sig = CURSIG(p)) != 0)
postsig(sig);
- p->p_priority = p->p_usrpri;
- if (want_resched) {
- /*
- * We are being preempted.
- */
- preempt(NULL);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
/*
* If profiling, charge recent system time to the trapped pc.
@@ -147,7 +138,7 @@
addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
}
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
+ curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
/*
@@ -163,18 +154,15 @@
register caddr_t params;
register const struct sysent *callp;
register struct proc *p;
- int error, opc, nsys;
+ int error;
size_t argsize;
register_t code, args[8], rval[2];
u_quad_t sticks;
p = curproc;
sticks = p->p_sticks;
- p->p_md.md_regs = frame;
- opc = frame->tf_eip;
code = frame->tf_eax;
- nsys = p->p_emul->e_nsysent;
callp = p->p_emul->e_sysent;
if (IBCS2_HIGH_SYSCALL(code))
@@ -204,7 +192,8 @@
default:
break;
}
- if (code < 0 || code >= nsys)
+
+ if ((u_int)code >= (u_int)p->p_emul->e_nsysent)
callp += p->p_emul->e_nosys; /* illegal */
else
callp += code;
@@ -222,15 +211,10 @@
ktrsyscall(p, code, argsize, args);
#endif /* KTRACE */
rval[0] = 0;
- rval[1] = frame->tf_edx;
+ rval[1] = 0;
error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
frame->tf_eax = rval[0];
frame->tf_edx = rval[1];
frame->tf_eflags &= ~PSL_C; /* carry bit */
@@ -241,7 +225,7 @@
* the kernel through the trap or call gate. We pushed the
* size of the instruction into tf_err on entry.
*/
- frame->tf_eip = opc - frame->tf_err;
+ frame->tf_eip -= frame->tf_err;
break;
case EJUSTRETURN:
/* nothing to do */
diff -r 31687cfc0467 -r 16b94e20c6bb sys/arch/i386/i386/linux_syscall.c
--- a/sys/arch/i386/i386/linux_syscall.c Sat Dec 09 06:33:15 2000 +0000
+++ b/sys/arch/i386/i386/linux_syscall.c Sat Dec 09 06:34:07 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: linux_syscall.c,v 1.1 2000/12/02 16:03:24 jdolecek Exp $ */
+/* $NetBSD: linux_syscall.c,v 1.2 2000/12/09 06:34:07 mycroft Exp $ */
/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -122,18 +122,9 @@
{
int sig;
- /* take pending signals */
+ /* Take pending signals. */
while ((sig = CURSIG(p)) != 0)
postsig(sig);
- p->p_priority = p->p_usrpri;
- if (want_resched) {
- /*
- * We are being preempted.
- */
- preempt(NULL);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
/*
* If profiling, charge recent system time to the trapped pc.
@@ -144,7 +135,7 @@
addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
}
- curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
+ curcpu()->ci_schedstate.spc_curpriority = p->p_priority = p->p_usrpri;
}
/*
@@ -157,25 +148,19 @@
linux_syscall(frame)
struct trapframe *frame;
{
- register caddr_t params;
register const struct sysent *callp;
register struct proc *p;
- int error, opc, nsys;
+ int error;
size_t argsize;
register_t code, args[8], rval[2];
u_quad_t sticks;
p = curproc;
sticks = p->p_sticks;
- p->p_md.md_regs = frame;
- opc = frame->tf_eip;
code = frame->tf_eax;
- nsys = p->p_emul->e_nsysent;
callp = p->p_emul->e_sysent;
- params = (caddr_t)frame->tf_esp + sizeof(int);
-
#ifdef VM86
/*
* VM86 mode application found our syscall trap gate by accident; let
@@ -187,7 +172,7 @@
else
#endif /* VM86 */
- if (code < 0 || code >= nsys)
+ if ((u_int)code >= (u_int)p->p_emul->e_nsysent)
callp += p->p_emul->e_nosys; /* illegal */
else
callp += code;
@@ -223,15 +208,10 @@
ktrsyscall(p, code, argsize, args);
#endif /* KTRACE */
rval[0] = 0;
- rval[1] = frame->tf_edx;
+ rval[1] = 0;
error = (*callp->sy_call)(p, args, rval);
switch (error) {
case 0:
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
frame->tf_eax = rval[0];
frame->tf_eflags &= ~PSL_C; /* carry bit */
break;
@@ -241,7 +221,7 @@
* the kernel through the trap or call gate. We pushed the
* size of the instruction into tf_err on entry.
*/
- frame->tf_eip = opc - frame->tf_err;
+ frame->tf_eip -= frame->tf_err;
break;
case EJUSTRETURN:
/* nothing to do */
Home |
Main Index |
Thread Index |
Old Index