Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/sys/arch/vax/vax In cpu_upcall(), build a CALLG frame h...



details:   https://anonhg.NetBSD.org/src/rev/0f2d5e598009
branches:  nathanw_sa
changeset: 506675:0f2d5e598009
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jan 05 22:01:14 2003 +0000

description:
In cpu_upcall(), build a CALLG frame holding the arguments/count on
the stack, and provide an upcall trampoline that uses it to actually
call the upcall.  No need to save regs, etc., since upcalls never
return.

diffstat:

 sys/arch/vax/vax/machdep.c |  45 +++++++++++++++++++++++++++++++++++----------
 sys/arch/vax/vax/subr.S    |  12 ++++++++++--
 2 files changed, 45 insertions(+), 12 deletions(-)

diffs (99 lines):

diff -r d97d050d4223 -r 0f2d5e598009 sys/arch/vax/vax/machdep.c
--- a/sys/arch/vax/vax/machdep.c        Sun Jan 05 18:55:12 2003 +0000
+++ b/sys/arch/vax/vax/machdep.c        Sun Jan 05 22:01:14 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.120.4.14 2002/12/11 06:12:42 thorpej Exp $    */
+/* $NetBSD: machdep.c,v 1.120.4.15 2003/01/05 22:01:14 thorpej Exp $    */
 
 /*
  * Copyright (c) 2002, Hugh Graham.
@@ -943,22 +943,47 @@
 }
 #endif
 
+/*
+ * This is an argument list pushed onto the stack, and given to
+ * a CALLG instruction in the trampoline.
+ */
+struct saframe {
+       int     sa_type;
+       void    *sa_sas;
+       int     sa_events;
+       int     sa_interrupted;
+       void    *sa_ap;
+
+       int     sa_argc;
+};
+
 void
 cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted,
     void *sas, void *ap, void *sp, sa_upcall_t upcall)
 {
        struct proc *p = l->l_proc;
        struct trapframe *tf = l->l_addr->u_pcb.framep;
+       struct saframe *sf, frame;
+       extern char sigcode[], upcallcode[];
 
-       /* XXX - separate frame later */
-       tf->r2 = (long)type;
-       tf->r3 = (long)sas;
-       tf->r4 = (long)nevents;
-       tf->r5 = (long)ninterrupted;
-       tf->r6 = (long)ap;
-       tf->r7 = (long)upcall;
-       tf->sp = (long)sp;
-       tf->pc = (long)p->p_sigctx.ps_sigcode;
+       frame.sa_type = type;
+       frame.sa_sas = sas;
+       frame.sa_events = nevents;
+       frame.sa_interrupted = ninterrupted;
+       frame.sa_ap = ap;
+       frame.sa_argc = 5;
+
+       sf = ((struct saframe *)sp) - 1;
+       if (copyout(&frame, sf, sizeof(frame)) != 0) {
+               /* Copying onto the stack didn't work, die. */
+               sigexit(l, SIGILL);
+               /* NOTREACHED */
+       }
+
+       tf->r0 = (long) upcall;
+       tf->sp = (long) sf;
+       tf->pc = (long) ((caddr_t)p->p_sigctx.ps_sigcode +
+                        ((caddr_t)upcallcode - (caddr_t)sigcode));
        tf->psl = (long)PSL_U | PSL_PREVU;
 }
 
diff -r d97d050d4223 -r 0f2d5e598009 sys/arch/vax/vax/subr.S
--- a/sys/arch/vax/vax/subr.S   Sun Jan 05 18:55:12 2003 +0000
+++ b/sys/arch/vax/vax/subr.S   Sun Jan 05 22:01:14 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr.S,v 1.2.2.8 2002/12/31 01:03:51 thorpej Exp $        */
+/*     $NetBSD: subr.S,v 1.2.2.9 2003/01/05 22:01:17 thorpej Exp $        */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -162,7 +162,7 @@
  */
 
        .align  2
-       .globl  _C_LABEL(sigcode),_C_LABEL(esigcode)
+       .globl  _C_LABEL(sigcode),_C_LABEL(upcallcode),_C_LABEL(esigcode)
 _C_LABEL(sigcode):
        pushr   $0x3f
        subl2   $0xc,%sp
@@ -172,6 +172,14 @@
        chmk    $SYS___sigreturn14
        chmk    $SYS_exit
        halt    
+
+/*
+ * Trampoline for SA upcalls.  This would be totally unnecessary if we
+ * didn't need to account for the saved registers in the callee.
+ */
+_C_LABEL(upcallcode):
+       callg   (%sp),(%r0)
+       halt
 _C_LABEL(esigcode):
 
 #ifdef COMPAT_IBCS2



Home | Main Index | Thread Index | Old Index