Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux/arch/alpha Add sigset_t parameter to restor...



details:   https://anonhg.NetBSD.org/src/rev/79c80fe1f8f2
branches:  trunk
changeset: 483809:79c80fe1f8f2
user:      erh <erh%NetBSD.org@localhost>
date:      Sat Mar 18 23:45:41 2000 +0000

description:
Add sigset_t parameter to restore_sigcontext, created by the sigreturn functions.  linux_sigreturn still needs to use frame->extramask.
In setup_linux_rt_sigframe copy the signal mask to both possible locations.

diffstat:

 sys/compat/linux/arch/alpha/linux_machdep.c |  49 +++++++++++++++-------------
 1 files changed, 27 insertions(+), 22 deletions(-)

diffs (111 lines):

diff -r b224e3523f8c -r 79c80fe1f8f2 sys/compat/linux/arch/alpha/linux_machdep.c
--- a/sys/compat/linux/arch/alpha/linux_machdep.c       Sat Mar 18 23:40:56 2000 +0000
+++ b/sys/compat/linux/arch/alpha/linux_machdep.c       Sat Mar 18 23:45:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.7 1999/09/12 01:17:31 chs Exp $    */
+/*     $NetBSD: linux_machdep.c,v 1.8 2000/03/18 23:45:41 erh Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -141,8 +141,12 @@
         */
        bzero(&sigframe.uc, sizeof(struct linux_ucontext));
        sigframe.uc.uc_mcontext.sc_onstack = onstack;
-       /* XXX XAX is sc_mask the correct field? isn't there more room here? */
-       native_to_linux_sigset(mask, &sigframe.uc.uc_mcontext.sc_mask);
+
+       /* Setup potentially partial signal mask in sc_mask. */
+       /* But get all of it in uc_sigmask */
+       native_to_linux_old_sigset(mask, &sigframe.uc.uc_mcontext.sc_mask);
+       native_to_linux_sigset(mask, &sigframe.uc.uc_sigmask);
+
        sigframe.uc.uc_mcontext.sc_pc = tf->tf_regs[FRAME_PC];
        sigframe.uc.uc_mcontext.sc_ps = ALPHA_PSL_USERMODE;
        frametoreg(tf, (struct reg *)sigframe.uc.uc_mcontext.sc_regs);
@@ -357,11 +361,9 @@
  */
 
 int
-linux_restore_sigcontext(p, context)
-       struct proc *p;
-       struct linux_sigcontext context;
+linux_restore_sigcontext(struct proc *p, struct linux_sigcontext context,
+                        sigset_t *mask)
 {
-       sigset_t bss;
 
        /*
         * Linux doesn't (yet) have alternate signal stacks.
@@ -374,9 +376,7 @@
            p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
 
        /* Reset the signal mask */
-       /* XXX XAX which sigset do we use? */
-       linux_to_native_sigset(&context.sc_mask, &bss);
-       (void) sigprocmask1(p, SIG_SETMASK, &bss, 0);
+       (void) sigprocmask1(p, SIG_SETMASK, mask, 0);
 
        /*
         * Check for security violations.
@@ -417,6 +417,7 @@
                syscallarg(struct linux_rt_sigframe *) sfp;
        } */ *uap = v;
        struct linux_rt_sigframe *sfp, sigframe;
+       sigset_t mask;
 
        /*
         * The trampoline code hands us the context.
@@ -436,7 +437,10 @@
                        sizeof(struct linux_rt_sigframe)) != 0)
                return (EFAULT);
 
-       return(linux_restore_sigcontext(p, sigframe.uc.uc_mcontext));
+       /* Grab the signal mask */
+       linux_to_native_sigset(&sigframe.uc.uc_sigmask, &mask);
+
+       return(linux_restore_sigcontext(p, sigframe.uc.uc_mcontext, &mask));
 }
 
 
@@ -449,7 +453,8 @@
        struct linux_sys_sigreturn_args /* {
                syscallarg(struct linux_sigframe *) sfp;
        } */ *uap = v;
-       struct linux_sigcontext *scp, context;
+       struct linux_sigframe *sfp, frame;
+       sigset_t mask;
 
        /*
         * The trampoline code hands us the context.
@@ -457,21 +462,21 @@
         * program jumps out of a signal handler.
         */
 
-       /* XXX Only works because sigcontext is first in sigframe */
-       /* XXX extramask is ignored */
-       scp = (struct linux_sigcontext *)SCARG(uap, sfp);
-
-       if (ALIGN(scp) != (u_int64_t)scp)
+       sfp = SCARG(uap, sfp);
+       if (ALIGN(sfp) != (u_int64_t)sfp)
                return(EINVAL);
 
        /*
-        * Fetch the context structure.
+        * Fetch the frame structure.
         */
-       if (copyin((caddr_t)scp, &context,
-                       sizeof(struct linux_sigcontext)) != 0)
-               return (EFAULT);
+       if (copyin((caddr_t)sfp, &frame, sizeof(struct linux_sigframe)) != 0)
+               return(EFAULT);
 
-       return(linux_restore_sigcontext(p, context));
+       /* Grab the signal mask. */
+       /* XXX use frame.extramask */
+       linux_old_to_native_sigset(frame.sf_sc.sc_mask, &mask);
+
+       return(linux_restore_sigcontext(p, frame.sf_sc, &mask));
 }
 
 /*



Home | Main Index | Thread Index | Old Index