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 Set md_regs before call the alternate sys...



details:   https://anonhg.NetBSD.org/src/rev/31687cfc0467
branches:  trunk
changeset: 500273:31687cfc0467
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sat Dec 09 06:33:15 2000 +0000

description:
Set md_regs before call the alternate syscall handler.
Remove the EMUL_HAS_SYS___syscall test, because the handler is no longer shared
with SVR4.
Rather than comparing with e_nsysent, just mask the value.  This is only done
to protect us from malicious programs anyway.

diffstat:

 sys/arch/i386/i386/trap.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (47 lines):

diff -r 2caf54c768ed -r 31687cfc0467 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sat Dec 09 06:30:54 2000 +0000
+++ b/sys/arch/i386/i386/trap.c Sat Dec 09 06:33:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.147 2000/12/09 02:46:17 mycroft Exp $       */
+/*     $NetBSD: trap.c,v 1.148 2000/12/09 06:33:15 mycroft Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -588,13 +588,14 @@
 #endif
 
        p = curproc;
+       p->p_md.md_regs = &frame;
+
        if (p->p_emul->e_syscall) {
                p->p_emul->e_syscall(&frame);
                return;
        }
 
        sticks = p->p_sticks;
-       p->p_md.md_regs = &frame;
        code = frame.tf_eax;
 
        callp = p->p_emul->e_sysent;
@@ -625,18 +626,13 @@
                 * Like syscall, but code is a quad, so as to maintain
                 * quad alignment for the rest of the arguments.
                 */
-               if (p->p_emul->e_flags & EMUL_HAS_SYS___syscall) {
-                       code = fuword(params + _QUAD_LOWWORD * sizeof(int));
-                       params += sizeof(quad_t);
-               }
+               code = fuword(params + _QUAD_LOWWORD * sizeof(int));
+               params += sizeof(quad_t);
                break;
        default:
                break;
        }
-       if ((u_int)code >= (u_int)p->p_emul->e_nsysent)
-               callp += p->p_emul->e_nosys;            /* illegal */
-       else
-               callp += code;
+       callp += (code & (SYS_NSYSENT - 1));
        argsize = callp->sy_argsize;
        if (argsize) {
                error = copyin(params, (caddr_t)args, argsize);



Home | Main Index | Thread Index | Old Index