Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips - leave lwp0 trapframe zerod since it's n...



details:   https://anonhg.NetBSD.org/src/rev/0c3b9310adfc
branches:  trunk
changeset: 760245:0c3b9310adfc
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Sat Jan 01 02:08:10 2011 +0000

description:
- leave lwp0 trapframe zerod since it's never used.
- 64bit op SR[KX] bit is for !o32 cases.
- build struct sigframe_siginfo locally and then operate single copyout()
  to user stack as other ports do.

diffstat:

 sys/arch/mips/mips/mips_machdep.c |  15 ++++++-------
 sys/arch/mips/mips/sig_machdep.c  |  44 +++++++++++++++++---------------------
 2 files changed, 27 insertions(+), 32 deletions(-)

diffs (130 lines):

diff -r 759bb472254d -r 0c3b9310adfc sys/arch/mips/mips/mips_machdep.c
--- a/sys/arch/mips/mips/mips_machdep.c Sat Jan 01 01:36:10 2011 +0000
+++ b/sys/arch/mips/mips/mips_machdep.c Sat Jan 01 02:08:10 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_machdep.c,v 1.228 2010/11/10 09:27:23 uebayasi Exp $      */
+/*     $NetBSD: mips_machdep.c,v 1.229 2011/01/01 02:08:10 nisimura Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.228 2010/11/10 09:27:23 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.229 2011/01/01 02:08:10 nisimura Exp $");
 
 #include "opt_cputype.h"
 #include "opt_compat_netbsd32.h"
@@ -1643,22 +1643,21 @@
 void
 mips_init_lwp0_uarea(void)
 {
-       vaddr_t v = uvm_pageboot_alloc(USPACE);
+       vaddr_t v;
+       struct pcb * const pcb0;
 
+       v = uvm_pageboot_alloc(USPACE);
        uvm_lwp_setuarea(&lwp0, v);
 
-       struct pcb * const pcb0 = lwp_getpcb(&lwp0);
+       pcb0  = lwp_getpcb(&lwp0);
        lwp0.l_md.md_regs = (struct frame *)(v + USPACE) - 1;
        /*
         * Now zero out the only two areas of the uarea that we care about.
         */
        memset(lwp0.l_md.md_regs, 0, sizeof(*lwp0.l_md.md_regs));
        memset(pcb0, 0, sizeof(*pcb0));
-#ifdef _LP64
-       lwp0.l_md.md_regs->f_regs[_R_SR] = MIPS_SR_KX;
-#endif
        pcb0->pcb_context.val[_L_SR] =
-#ifdef _LP64
+#if !defined(__mips_o32)
            MIPS_SR_KX |
 #endif
            MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
diff -r 759bb472254d -r 0c3b9310adfc sys/arch/mips/mips/sig_machdep.c
--- a/sys/arch/mips/mips/sig_machdep.c  Sat Jan 01 01:36:10 2011 +0000
+++ b/sys/arch/mips/mips/sig_machdep.c  Sat Jan 01 02:08:10 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig_machdep.c,v 1.19 2009/12/14 00:46:07 matt Exp $    */
+/*     $NetBSD: sig_machdep.c,v 1.20 2011/01/01 02:08:10 nisimura Exp $        */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
        
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.19 2009/12/14 00:46:07 matt Exp $"); 
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.20 2011/01/01 02:08:10 nisimura Exp $"); 
 
 #include "opt_cputype.h"
 
@@ -60,9 +60,8 @@
            && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
        if (*onstack)
                return (char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size;
-       else
-               return (void *)(intptr_t)fp->f_regs[_R_SP];
-}              
+       return (void *)(intptr_t)fp->f_regs[_R_SP];
+}
 
 struct sigframe_siginfo {
        siginfo_t sf_si;
@@ -78,30 +77,26 @@
        struct lwp *l = curlwp;
        struct proc *p = l->l_proc;
        struct sigacts *ps = p->p_sigacts;
+       struct frame *tf;
+       struct sigframe_siginfo *fp, frame;
        int onstack, error;
        int sig = ksi->ksi_signo;
-       struct sigframe_siginfo *fp = getframe(l, sig, &onstack);
-       struct frame *tf;
-       ucontext_t uc;
-       size_t ucsz;
        sig_t catcher = SIGACTION(p, sig).sa_handler;
 
-       tf = l->l_md.md_regs;
-       fp--;
+       fp = (struct sigframe_siginfo *)getframe(l, sig, &onstack) - 1;
 
-        uc.uc_flags = _UC_SIGMASK
-            | ((l->l_sigstk.ss_flags & SS_ONSTACK)
-            ? _UC_SETSTACK : _UC_CLRSTACK);
-        uc.uc_sigmask = *mask;
-        uc.uc_link = l->l_ctxlink;
-        memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
-        ucsz = (char *)&uc.__uc_pad - (char *)&uc;
-        sendsig_reset(l, sig);
-        mutex_exit(p->p_lock);
-        cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);
-       error = copyout(&ksi->ksi_info, &fp->sf_si, sizeof(ksi->ksi_info));
-       if (error == 0)
-               error = copyout(&uc, &fp->sf_uc, ucsz);
+       frame.sf_si._info = ksi->ksi_info;
+       frame.sf_uc.uc_flags = _UC_SIGMASK
+           | ((l->l_sigstk.ss_flags & SS_ONSTACK)
+           ? _UC_SETSTACK : _UC_CLRSTACK);
+       frame.sf_uc.uc_sigmask = *mask;
+       frame.sf_uc.uc_link = l->l_ctxlink;
+       memset(&frame.sf_uc.uc_stack, 0, sizeof(frame.sf_uc.uc_stack));
+       sendsig_reset(l, sig);
+
+       mutex_exit(p->p_lock);
+       cpu_getmcontext(l, &frame.sf_uc.uc_mcontext, &frame.sf_uc.uc_flags);
+       error = copyout(&frame, fp, sizeof(frame));
        mutex_enter(p->p_lock);
 
        if (error != 0) {
@@ -118,6 +113,7 @@
         * handler.  The return address will be set up to point
         * to the signal trampoline to bounce us back.
         */
+       tf = l->l_md.md_regs;
        tf->f_regs[_R_A0] = sig;
        tf->f_regs[_R_A1] = (intptr_t)&fp->sf_si;
        tf->f_regs[_R_A2] = (intptr_t)&fp->sf_uc;



Home | Main Index | Thread Index | Old Index