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 make locore.s call emulation-specific sys...



details:   https://anonhg.NetBSD.org/src/rev/e809dd88a466
branches:  trunk
changeset: 500293:e809dd88a466
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Dec 09 13:20:04 2000 +0000

description:
make locore.s call emulation-specific syscall code directly
this should improve speed of emulation syscall path (avoids one function call,
and emulations syscall can use the trapframe trick)
Idea: Charles Hannum

diffstat:

 sys/arch/i386/i386/genassym.cf     |   5 ++++-
 sys/arch/i386/i386/ibcs2_syscall.c |  26 +++++++++++++-------------
 sys/arch/i386/i386/linux_syscall.c |  32 ++++++++++++++++----------------
 sys/arch/i386/i386/locore.s        |   7 +++++--
 sys/arch/i386/i386/svr4_syscall.c  |  26 +++++++++++++-------------
 5 files changed, 51 insertions(+), 45 deletions(-)

diffs (truncated from 333 to 300 lines):

diff -r a27d648f9834 -r e809dd88a466 sys/arch/i386/i386/genassym.cf
--- a/sys/arch/i386/i386/genassym.cf    Sat Dec 09 12:57:17 2000 +0000
+++ b/sys/arch/i386/i386/genassym.cf    Sat Dec 09 13:20:04 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.22 2000/11/29 21:53:47 jdolecek Exp $
+#      $NetBSD: genassym.cf,v 1.23 2000/12/09 13:20:04 jdolecek Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -142,9 +142,12 @@
 define P_WCHAN                 offsetof(struct proc, p_wchan)
 define P_FLAG                  offsetof(struct proc, p_flag)
 define P_MD_TSS_SEL            offsetof(struct proc, p_md.md_tss_sel)
+define P_EMUL                  offsetof(struct proc, p_emul)
 
 define P_SYSTEM                P_SYSTEM
 
+define E_SYSCALL               offsetof(struct emul, e_syscall)
+
 define M_DATA                  offsetof(struct mbuf, m_data)
 define M_LEN                   offsetof(struct mbuf, m_len)
 define M_NEXT                  offsetof(struct mbuf, m_next)
diff -r a27d648f9834 -r e809dd88a466 sys/arch/i386/i386/ibcs2_syscall.c
--- a/sys/arch/i386/i386/ibcs2_syscall.c        Sat Dec 09 12:57:17 2000 +0000
+++ b/sys/arch/i386/i386/ibcs2_syscall.c        Sat Dec 09 13:20:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_syscall.c,v 1.3 2000/12/09 11:21:52 jdolecek Exp $       */
+/*     $NetBSD: ibcs2_syscall.c,v 1.4 2000/12/09 13:20:05 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@
 #include <compat/ibcs2/ibcs2_errno.h>
 #include <compat/ibcs2/ibcs2_exec.h>
 
-void ibcs2_syscall __P((struct trapframe *));
+void ibcs2_syscall __P((struct trapframe));
 
 /*
  * syscall(frame):
@@ -118,7 +118,7 @@
 /*ARGSUSED*/
 void
 ibcs2_syscall(frame)
-       struct trapframe *frame;
+       struct trapframe frame;
 {
        register caddr_t params;
        register const struct sysent *callp;
@@ -130,14 +130,14 @@
 
        p = curproc;
        sticks = p->p_sticks;
-       code = frame->tf_eax;
+       code = frame.tf_eax;
 
        callp = p->p_emul->e_sysent;
 
        if (IBCS2_HIGH_SYSCALL(code))
                code = IBCS2_CVT_HIGH_SYSCALL(code);
 
-       params = (caddr_t)frame->tf_esp + sizeof(int);
+       params = (caddr_t)frame.tf_esp + sizeof(int);
 
 #ifdef VM86
        /*
@@ -145,7 +145,7 @@
         * it get a SIGSYS and have the VM86 handler in the process take care
         * of it.
         */
-       if (frame->tf_eflags & PSL_VM)
+       if (frame.tf_eflags & PSL_VM)
                code = -1;
        else
 #endif /* VM86 */
@@ -184,9 +184,9 @@
        error = (*callp->sy_call)(p, args, rval);
        switch (error) {
        case 0:
-               frame->tf_eax = rval[0];
-               frame->tf_edx = rval[1];
-               frame->tf_eflags &= ~PSL_C;     /* carry bit */
+               frame.tf_eax = rval[0];
+               frame.tf_edx = rval[1];
+               frame.tf_eflags &= ~PSL_C;      /* carry bit */
                break;
        case ERESTART:
                /*
@@ -194,7 +194,7 @@
                 * the kernel through the trap or call gate.  We pushed the
                 * size of the instruction into tf_err on entry.
                 */
-               frame->tf_eip -= frame->tf_err;
+               frame.tf_eip -= frame.tf_err;
                break;
        case EJUSTRETURN:
                /* nothing to do */
@@ -203,15 +203,15 @@
        bad:
                if (p->p_emul->e_errno)
                        error = p->p_emul->e_errno[error];
-               frame->tf_eax = error;
-               frame->tf_eflags |= PSL_C;      /* carry bit */
+               frame.tf_eax = error;
+               frame.tf_eflags |= PSL_C;       /* carry bit */
                break;
        }
 
 #ifdef SYSCALL_DEBUG
        scdebug_ret(p, code, error, rval);
 #endif /* SYSCALL_DEBUG */
-       userret(p, frame->tf_eip, sticks);
+       userret(p, frame.tf_eip, sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
                ktrsysret(p, code, error, rval[0]);
diff -r a27d648f9834 -r e809dd88a466 sys/arch/i386/i386/linux_syscall.c
--- a/sys/arch/i386/i386/linux_syscall.c        Sat Dec 09 12:57:17 2000 +0000
+++ b/sys/arch/i386/i386/linux_syscall.c        Sat Dec 09 13:20:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_syscall.c,v 1.3 2000/12/09 11:21:52 jdolecek Exp $       */
+/*     $NetBSD: linux_syscall.c,v 1.4 2000/12/09 13:20:05 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@
 #include <compat/ibcs2/ibcs2_errno.h>
 #include <compat/ibcs2/ibcs2_exec.h>
 
-void linux_syscall __P((struct trapframe *));
+void linux_syscall __P((struct trapframe));
 
 /*
  * syscall(frame):
@@ -118,7 +118,7 @@
 /*ARGSUSED*/
 void
 linux_syscall(frame)
-       struct trapframe *frame;
+       struct trapframe frame;
 {
        register const struct sysent *callp;
        register struct proc *p;
@@ -129,7 +129,7 @@
 
        p = curproc;
        sticks = p->p_sticks;
-       code = frame->tf_eax;
+       code = frame.tf_eax;
 
        callp = p->p_emul->e_sysent;
 
@@ -139,7 +139,7 @@
         * it get a SIGSYS and have the VM86 handler in the process take care
         * of it.
         */
-       if (frame->tf_eflags & PSL_VM)
+       if (frame.tf_eflags & PSL_VM)
                code = -1;
        else
 #endif /* VM86 */
@@ -156,15 +156,15 @@
                 */
                switch (argsize >> 2) {
                case 5:
-                       args[4] = frame->tf_edi;
+                       args[4] = frame.tf_edi;
                case 4:
-                       args[3] = frame->tf_esi;
+                       args[3] = frame.tf_esi;
                case 3:
-                       args[2] = frame->tf_edx;
+                       args[2] = frame.tf_edx;
                case 2:
-                       args[1] = frame->tf_ecx;
+                       args[1] = frame.tf_ecx;
                case 1:
-                       args[0] = frame->tf_ebx;
+                       args[0] = frame.tf_ebx;
                        break;
                default:
                        panic("linux syscall bogus argument size %d",
@@ -184,8 +184,8 @@
        error = (*callp->sy_call)(p, args, rval);
        switch (error) {
        case 0:
-               frame->tf_eax = rval[0];
-               frame->tf_eflags &= ~PSL_C;     /* carry bit */
+               frame.tf_eax = rval[0];
+               frame.tf_eflags &= ~PSL_C;      /* carry bit */
                break;
        case ERESTART:
                /*
@@ -193,7 +193,7 @@
                 * the kernel through the trap or call gate.  We pushed the
                 * size of the instruction into tf_err on entry.
                 */
-               frame->tf_eip -= frame->tf_err;
+               frame.tf_eip -= frame.tf_err;
                break;
        case EJUSTRETURN:
                /* nothing to do */
@@ -201,15 +201,15 @@
        default:
                if (p->p_emul->e_errno)
                        error = p->p_emul->e_errno[error];
-               frame->tf_eax = error;
-               frame->tf_eflags |= PSL_C;      /* carry bit */
+               frame.tf_eax = error;
+               frame.tf_eflags |= PSL_C;       /* carry bit */
                break;
        }
 
 #ifdef SYSCALL_DEBUG
        scdebug_ret(p, code, error, rval);
 #endif /* SYSCALL_DEBUG */
-       userret(p, frame->tf_eip, sticks);
+       userret(p, frame.tf_eip, sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
                ktrsysret(p, code, error, rval[0]);
diff -r a27d648f9834 -r e809dd88a466 sys/arch/i386/i386/locore.s
--- a/sys/arch/i386/i386/locore.s       Sat Dec 09 12:57:17 2000 +0000
+++ b/sys/arch/i386/i386/locore.s       Sat Dec 09 13:20:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.228 2000/12/08 23:14:04 mycroft Exp $     */
+/*     $NetBSD: locore.s,v 1.229 2000/12/09 13:20:05 jdolecek Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2360,7 +2360,10 @@
 #ifdef DIAGNOSTIC
        movl    _C_LABEL(cpl),%ebx
 #endif /* DIAGNOSTIC */
-       call    _C_LABEL(syscall)
+       movl    _C_LABEL(curproc),%edx  # get pointer to curproc
+       movl    P_EMUL(%edx),%edx       # get pointer to emul struct
+       movl    E_SYSCALL(%edx),%edx    # get pointer to syscall() function
+       call    %edx                    # call emulation's syscall()
 2:     /* Check for ASTs on exit to user mode. */
        cli
        cmpb    $0,_C_LABEL(astpending)
diff -r a27d648f9834 -r e809dd88a466 sys/arch/i386/i386/svr4_syscall.c
--- a/sys/arch/i386/i386/svr4_syscall.c Sat Dec 09 12:57:17 2000 +0000
+++ b/sys/arch/i386/i386/svr4_syscall.c Sat Dec 09 13:20:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svr4_syscall.c,v 1.2 2000/12/09 11:21:52 jdolecek Exp $        */
+/*     $NetBSD: svr4_syscall.c,v 1.3 2000/12/09 13:20:05 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
 
 #include <compat/svr4/svr4_syscall.h>
 
-void svr4_syscall __P((struct trapframe *));
+void svr4_syscall __P((struct trapframe));
 
 /*
  * syscall(frame):
@@ -117,7 +117,7 @@
 /*ARGSUSED*/
 void
 svr4_syscall(frame)
-       struct trapframe *frame;
+       struct trapframe frame;
 {
        register caddr_t params;
        register const struct sysent *callp;
@@ -129,11 +129,11 @@
 
        p = curproc;
        sticks = p->p_sticks;
-       code = frame->tf_eax;
+       code = frame.tf_eax;
 
        callp = p->p_emul->e_sysent;
 
-       params = (caddr_t)frame->tf_esp + sizeof(int);
+       params = (caddr_t)frame.tf_esp + sizeof(int);
 
 #ifdef VM86
        /*
@@ -141,7 +141,7 @@
         * it get a SIGSYS and have the VM86 handler in the process take care
         * of it.
         */
-       if (frame->tf_eflags & PSL_VM)
+       if (frame.tf_eflags & PSL_VM)
                code = -1;
        else
 #endif /* VM86 */
@@ -176,9 +176,9 @@
        error = (*callp->sy_call)(p, args, rval);
        switch (error) {
        case 0:
-               frame->tf_eax = rval[0];
-               frame->tf_edx = rval[1];
-               frame->tf_eflags &= ~PSL_C;     /* carry bit */
+               frame.tf_eax = rval[0];



Home | Main Index | Thread Index | Old Index