]> git.neil.brown.name Git - history.git/commitdiff
PPC32: Adjust ucontext to conform with historical practice and with glibc.
authorPaul Mackerras <paulus@samba.org>
Sat, 27 Sep 2003 09:07:22 +0000 (19:07 +1000)
committerPaul Mackerras <paulus@samba.org>
Sat, 27 Sep 2003 09:07:22 +0000 (19:07 +1000)
This moves the uc_sigmask field back to where it was before.  We now don't
assume the registers are at a fixed offset in the ucontext, but instead
access them through the uc_regs field as in the past.  This corresponds with
a recent change in glibc CVS.

arch/ppc/kernel/signal.c
include/asm-ppc/ucontext.h

index 3558caa4c2be2aaabce6b24a318088f0245e6fa0..4f2be30b038a101736922a0970c3e64713401cad 100644 (file)
@@ -272,7 +272,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr)
                                     sizeof(sr->mc_vregs)))
                        return 1;
        } else if (current->thread.used_vr)
-               memset(&current->thread.vr, 0, sizeof(current->thread.vr));
+               memset(&current->thread.vr, 0, ELF_NVRREG * sizeof(vector128));
 
        /* Always get VRSAVE back */
        if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
@@ -328,7 +328,6 @@ handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
                          &rt_sf->uc.uc_stack.ss_flags)
            || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
            || __put_user(&rt_sf->uc.uc_mcontext, &rt_sf->uc.uc_regs)
-           || __copy_to_user(&rt_sf->uc.uc_oldsigmask, oldset, sizeof(*oldset))
            || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset)))
                goto badframe;
 
@@ -363,12 +362,13 @@ badframe:
 static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs)
 {
        sigset_t set;
+       struct mcontext *mcp;
 
-       if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set)))
+       if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))
+           || __get_user(mcp, &ucp->uc_regs))
                return -EFAULT;
        restore_sigmask(&set);
-
-       if (restore_user_regs(regs, &ucp->uc_mcontext))
+       if (restore_user_regs(regs, mcp))
                return -EFAULT;
 
        return 0;
@@ -385,9 +385,6 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
                    || save_user_regs(regs, &old_ctx->uc_mcontext, 0)
                    || __copy_to_user(&old_ctx->uc_sigmask,
                                      &current->blocked, sizeof(sigset_t))
-                   /* the next 2 things aren't strictly necessary */
-                   || __copy_to_user(&old_ctx->uc_oldsigmask,
-                                     &current->blocked, sizeof(sigset_t))
                    || __put_user(&old_ctx->uc_mcontext, &old_ctx->uc_regs))
                        return -EFAULT;
        }
index 1d6e70c4306d36be74cc1db8136f4418d3342808..53da26040a0e8a273be062216d83565149499331 100644 (file)
@@ -16,12 +16,11 @@ struct ucontext {
        struct ucontext *uc_link;
        stack_t          uc_stack;
        int              uc_pad[7];
-       struct mcontext *uc_regs;       /* backward compat */
-       sigset_t         uc_oldsigmask; /* backward compat */
-       int              uc_pad2;
+       struct mcontext *uc_regs;       /* points to uc_mcontext field */
        sigset_t         uc_sigmask;
        /* glibc has 1024-bit signal masks, ours are 64-bit */
        int              uc_maskext[30];
+       int              uc_pad2[3];
        struct mcontext  uc_mcontext;
 };