[PATCH] m32r: fix and update for gcc-4.0

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>
This commit is contained in:
Hirokazu Takata 2006-02-24 13:03:51 -08:00 коммит произвёл Linus Torvalds
Родитель cde05cf214
Коммит 6ced13cdca
3 изменённых файлов: 16 добавлений и 20 удалений

Просмотреть файл

@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *);
asmlinkage int asmlinkage int
sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
unsigned long r2, unsigned long r3, unsigned long r4, 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; sigset_t saveset, newset;
@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
recalc_sigpending(); recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->sighand->siglock);
regs.r0 = -EINTR; regs->r0 = -EINTR;
while (1) { while (1) {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
if (do_signal(&regs, &saveset)) if (do_signal(regs, &saveset))
return regs.r0; return regs->r0;
} }
} }
asmlinkage int asmlinkage int
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
unsigned long r2, unsigned long r3, unsigned long r4, 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 asmlinkage int
sys_rt_sigreturn(unsigned long r0, unsigned long r1, sys_rt_sigreturn(unsigned long r0, unsigned long r1,
unsigned long r2, unsigned long r3, unsigned long r4, 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; sigset_t set;
stack_t st;
int result; int result;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
recalc_sigpending(); recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock); 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; 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; 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; return result;

Просмотреть файл

@ -64,7 +64,7 @@ do { \
" .balign 4\n" \ " .balign 4\n" \
" .long 0b,3b\n" \ " .long 0b,3b\n" \
".previous" \ ".previous" \
: "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
"=&r" (__d2) \ "=&r" (__d2) \
: "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
"4"(dst) \ "4"(dst) \
@ -101,7 +101,7 @@ do { \
" .balign 4\n" \ " .balign 4\n" \
" .long 0b,3b\n" \ " .long 0b,3b\n" \
".previous" \ ".previous" \
: "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
"=&r" (__d2) \ "=&r" (__d2) \
: "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
"4"(dst) \ "4"(dst) \

Просмотреть файл

@ -328,7 +328,7 @@ extern void __put_user_bad(void);
" .long 1b,4b\n" \ " .long 1b,4b\n" \
" .long 2b,4b\n" \ " .long 2b,4b\n" \
".previous" \ ".previous" \
: "=r"(err) \ : "=&r"(err) \
: "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
: "r14", "memory") : "r14", "memory")
@ -353,7 +353,7 @@ extern void __put_user_bad(void);
" .long 1b,4b\n" \ " .long 1b,4b\n" \
" .long 2b,4b\n" \ " .long 2b,4b\n" \
".previous" \ ".previous" \
: "=r"(err) \ : "=&r"(err) \
: "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
: "r14", "memory") : "r14", "memory")
#else #else
@ -398,7 +398,7 @@ struct __large_struct { unsigned long buf[100]; };
" .balign 4\n" \ " .balign 4\n" \
" .long 1b,3b\n" \ " .long 1b,3b\n" \
".previous" \ ".previous" \
: "=r"(err) \ : "=&r"(err) \
: "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \ : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
: "r14", "memory") : "r14", "memory")
@ -442,7 +442,7 @@ do { \
" .balign 4\n" \ " .balign 4\n" \
" .long 1b,3b\n" \ " .long 1b,3b\n" \
".previous" \ ".previous" \
: "=r"(err), "=&r"(x) \ : "=&r"(err), "=&r"(x) \
: "r"(addr), "i"(-EFAULT), "0"(err) \ : "r"(addr), "i"(-EFAULT), "0"(err) \
: "r14", "memory") : "r14", "memory")