[PATCH] m32r: fix and update for gcc-4.0
Hirokazu Takata [Fri, 24 Feb 2006 21:03:51 +0000 (13:03 -0800)]
Fix and update for gcc-4.0.

- arch/m32r/kernel/signal.c:
  Change type of the 8th parameter of sys_rt_sigsuspend() from
  'struct pt_regs' to 'struct pt_regs *'.
  This functions make use of the 'regs' parameter to return status value,
  but gcc-4.0 optimizes and removes it as a dead code.
  Functions, sys_sigaltstack() and sys_rt_sigreturn(), have also modified.

- arch/m32r/lib/usercopy.c, include/asm-m32r/uaccess.h:
  Add early-clobber constraints('&') to output values of asm statements;
  these constraints seems to be required for gcc-4.0 register assignment.

Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

arch/m32r/kernel/signal.c
arch/m32r/lib/usercopy.c
include/asm-m32r/uaccess.h

index 71763f7..cb33097 100644 (file)
@@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *);
 asmlinkage int
 sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
                  unsigned long r2, unsigned long r3, unsigned long r4,
-                 unsigned long r5, unsigned long r6, struct pt_regs regs)
+                 unsigned long r5, unsigned long r6, struct pt_regs *regs)
 {
        sigset_t saveset, newset;
 
@@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
-       regs.r0 = -EINTR;
+       regs->r0 = -EINTR;
        while (1) {
                current->state = TASK_INTERRUPTIBLE;
                schedule();
-               if (do_signal(&regs, &saveset))
-                       return regs.r0;
+               if (do_signal(regs, &saveset))
+                       return regs->r0;
        }
 }
 
 asmlinkage int
 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
                unsigned long r2, unsigned long r3, unsigned long r4,
-               unsigned long r5, unsigned long r6, struct pt_regs regs)
+               unsigned long r5, unsigned long r6, struct pt_regs *regs)
 {
-       return do_sigaltstack(uss, uoss, regs.spu);
+       return do_sigaltstack(uss, uoss, regs->spu);
 }
 
 
@@ -140,11 +140,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
 asmlinkage int
 sys_rt_sigreturn(unsigned long r0, unsigned long r1,
                 unsigned long r2, unsigned long r3, unsigned long r4,
-                unsigned long r5, unsigned long r6, struct pt_regs regs)
+                unsigned long r5, unsigned long r6, struct pt_regs *regs)
 {
-       struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu;
+       struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu;
        sigset_t set;
-       stack_t st;
        int result;
 
        if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
 
-       if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &result))
+       if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
                goto badframe;
 
-       if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
+       if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT)
                goto badframe;
-       /* It is more difficult to avoid calling this function than to
-          call it and ignore errors.  */
-       do_sigaltstack(&st, NULL, regs.spu);
 
        return result;
 
index ce16bbe..2d1dd21 100644 (file)
@@ -64,7 +64,7 @@ do {                                                                  \
                "       .balign 4\n"                                    \
                "       .long 0b,3b\n"                                  \
                ".previous"                                             \
-               : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1),   \
+               : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
                  "=&r" (__d2)                                          \
                : "i"(-EFAULT), "0"(count), "1"(count), "3"(src),       \
                  "4"(dst)                                              \
@@ -101,7 +101,7 @@ do {                                                                        \
                "       .balign 4\n"                                    \
                "       .long 0b,3b\n"                                  \
                ".previous"                                             \
-               : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1),   \
+               : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
                  "=&r" (__d2)                                          \
                : "i"(-EFAULT), "0"(count), "1"(count), "3"(src),       \
                  "4"(dst)                                              \
index 0da7c47..e8ae619 100644 (file)
@@ -328,7 +328,7 @@ extern void __put_user_bad(void);
                 "       .long 1b,4b\n"                                  \
                 "       .long 2b,4b\n"                                  \
                 ".previous"                                             \
-                : "=r"(err)                                             \
+                : "=&r"(err)                                             \
                 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err)            \
                 : "r14", "memory")
 
@@ -353,7 +353,7 @@ extern void __put_user_bad(void);
                "       .long 1b,4b\n"                                  \
                "       .long 2b,4b\n"                                  \
                ".previous"                                             \
-               : "=r"(err)                                             \
+               : "=&r"(err)                                            \
                : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err)             \
                : "r14", "memory")
 #else
@@ -398,7 +398,7 @@ struct __large_struct { unsigned long buf[100]; };
                "       .balign 4\n"                                    \
                "       .long 1b,3b\n"                                  \
                ".previous"                                             \
-               : "=r"(err)                                             \
+               : "=&r"(err)                                            \
                : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err)             \
                : "r14", "memory")
 
@@ -442,7 +442,7 @@ do {                                                                        \
                "       .balign 4\n"                                    \
                "       .long 1b,3b\n"                                  \
                ".previous"                                             \
-               : "=r"(err), "=&r"(x)                                   \
+               : "=&r"(err), "=&r"(x)                                  \
                : "r"(addr), "i"(-EFAULT), "0"(err)                     \
                : "r14", "memory")