qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] linux-user: Rework __put_user and __get_user


From: Michal Privoznik
Subject: [Qemu-devel] [PATCH] linux-user: Rework __put_user and __get_user
Date: Tue, 3 Jun 2014 18:15:55 +0200

With the latest gcc-4.9.0 I'm getting some compile errors:

In file included from qemu.git/linux-user/syscall.c:113:0:
qemu.git/linux-user/syscall.c: In function ‘copy_from_user_fdset’:
qemu.git/linux-user/qemu.h:309:13: error: right-hand operand of comma 
expression has no effect [-Werror=unused-value]
      (hptr)), 0)
             ^
qemu.git/linux-user/qemu.h:316:31: note: in expansion of macro ‘__get_user_e’
 # define __get_user(x, hptr)  __get_user_e(x, hptr, le)
                               ^
qemu/qemu.git/linux-user/syscall.c:704:9: note: in expansion of macro 
‘__get_user’
         __get_user(b, &target_fds[i]);
         ^

Or:

qemu.git/linux-user/syscall.c: In function ‘copy_to_user_fdset’:
qemu.git/linux-user/qemu.h:301:19: error: right-hand operand of comma 
expression has no effect [-Werror=unused-value]
      ((hptr), (x)), 0)
                   ^
qemu.git/linux-user/qemu.h:315:31: note: in expansion of macro ‘__put_user_e’
 # define __put_user(x, hptr)  __put_user_e(x, hptr, le)
                               ^
qemu/qemu.git/linux-user/syscall.c:754:9: note: in expansion of macro 
‘__put_user’
         __put_user(v, &target_fds[i]);
         ^

Signed-off-by: Michal Privoznik <address@hidden>
---
 linux-user/qemu.h   |  10 +-
 linux-user/signal.c | 651 ++++++++++++++++++++++++----------------------------
 2 files changed, 310 insertions(+), 351 deletions(-)

diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 36d4a73..c932abf 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -298,7 +298,7 @@ static inline int access_ok(int type, abi_ulong addr, 
abi_ulong size)
    __builtin_choose_expr(sizeof(*(hptr)) == 2, stw_##e##_p,             \
    __builtin_choose_expr(sizeof(*(hptr)) == 4, stl_##e##_p,             \
    __builtin_choose_expr(sizeof(*(hptr)) == 8, stq_##e##_p, abort))))   \
-     ((hptr), (x)), 0)
+     ((hptr), (x)))
 
 #define __get_user_e(x, hptr, e)                                        \
   ((x) = (typeof(*hptr))(                                               \
@@ -306,7 +306,7 @@ static inline int access_ok(int type, abi_ulong addr, 
abi_ulong size)
    __builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p,            \
    __builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p,             \
    __builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort))))   \
-     (hptr)), 0)
+     (hptr)))
 
 #ifdef TARGET_WORDS_BIGENDIAN
 # define __put_user(x, hptr)  __put_user_e(x, hptr, be)
@@ -327,7 +327,8 @@ static inline int access_ok(int type, abi_ulong addr, 
abi_ulong size)
     target_type *__hptr;                                               \
     abi_long __ret;                                                    \
     if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) { 
\
-        __ret = __put_user((x), __hptr);                               \
+        __put_user((x), __hptr);                                       \
+        __ret = 0;                                                     \
         unlock_user(__hptr, __gaddr, sizeof(target_type));             \
     } else                                                             \
         __ret = -TARGET_EFAULT;                                                
\
@@ -340,7 +341,8 @@ static inline int access_ok(int type, abi_ulong addr, 
abi_ulong size)
     target_type *__hptr;                                               \
     abi_long __ret;                                                    \
     if ((__hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1))) { \
-        __ret = __get_user((x), __hptr);                               \
+        __get_user((x), __hptr);                                       \
+        __ret = 0;                                                     \
         unlock_user(__hptr, __gaddr, 0);                               \
     } else {                                                           \
         /* avoid warning */                                            \
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 5b8a01f..1be34b0 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -846,35 +846,35 @@ setup_sigcontext(struct target_sigcontext *sc, struct 
target_fpstate *fpstate,
     uint16_t magic;
 
        /* already locked in setup_frame() */
-       err |= __put_user(env->segs[R_GS].selector, (unsigned int *)&sc->gs);
-       err |= __put_user(env->segs[R_FS].selector, (unsigned int *)&sc->fs);
-       err |= __put_user(env->segs[R_ES].selector, (unsigned int *)&sc->es);
-       err |= __put_user(env->segs[R_DS].selector, (unsigned int *)&sc->ds);
-       err |= __put_user(env->regs[R_EDI], &sc->edi);
-       err |= __put_user(env->regs[R_ESI], &sc->esi);
-       err |= __put_user(env->regs[R_EBP], &sc->ebp);
-       err |= __put_user(env->regs[R_ESP], &sc->esp);
-       err |= __put_user(env->regs[R_EBX], &sc->ebx);
-       err |= __put_user(env->regs[R_EDX], &sc->edx);
-       err |= __put_user(env->regs[R_ECX], &sc->ecx);
-       err |= __put_user(env->regs[R_EAX], &sc->eax);
-    err |= __put_user(cs->exception_index, &sc->trapno);
-       err |= __put_user(env->error_code, &sc->err);
-       err |= __put_user(env->eip, &sc->eip);
-       err |= __put_user(env->segs[R_CS].selector, (unsigned int *)&sc->cs);
-       err |= __put_user(env->eflags, &sc->eflags);
-       err |= __put_user(env->regs[R_ESP], &sc->esp_at_signal);
-       err |= __put_user(env->segs[R_SS].selector, (unsigned int *)&sc->ss);
+       __put_user(env->segs[R_GS].selector, (unsigned int *)&sc->gs);
+       __put_user(env->segs[R_FS].selector, (unsigned int *)&sc->fs);
+       __put_user(env->segs[R_ES].selector, (unsigned int *)&sc->es);
+       __put_user(env->segs[R_DS].selector, (unsigned int *)&sc->ds);
+       __put_user(env->regs[R_EDI], &sc->edi);
+       __put_user(env->regs[R_ESI], &sc->esi);
+       __put_user(env->regs[R_EBP], &sc->ebp);
+       __put_user(env->regs[R_ESP], &sc->esp);
+       __put_user(env->regs[R_EBX], &sc->ebx);
+       __put_user(env->regs[R_EDX], &sc->edx);
+       __put_user(env->regs[R_ECX], &sc->ecx);
+       __put_user(env->regs[R_EAX], &sc->eax);
+    __put_user(cs->exception_index, &sc->trapno);
+       __put_user(env->error_code, &sc->err);
+       __put_user(env->eip, &sc->eip);
+       __put_user(env->segs[R_CS].selector, (unsigned int *)&sc->cs);
+       __put_user(env->eflags, &sc->eflags);
+       __put_user(env->regs[R_ESP], &sc->esp_at_signal);
+       __put_user(env->segs[R_SS].selector, (unsigned int *)&sc->ss);
 
         cpu_x86_fsave(env, fpstate_addr, 1);
         fpstate->status = fpstate->sw;
         magic = 0xffff;
-        err |= __put_user(magic, &fpstate->magic);
-        err |= __put_user(fpstate_addr, &sc->fpstate);
+        __put_user(magic, &fpstate->magic);
+        __put_user(fpstate_addr, &sc->fpstate);
 
        /* non-iBCS2 extensions.. */
-       err |= __put_user(mask, &sc->oldmask);
-       err |= __put_user(env->cr[2], &sc->cr2);
+       __put_user(mask, &sc->oldmask);
+       __put_user(env->cr[2], &sc->cr2);
        return err;
 }
 
@@ -918,8 +918,8 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
        if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
                goto give_sigsegv;
 
-       err |= __put_user(current_exec_domain_sig(sig),
-                         &frame->sig);
+       __put_user(current_exec_domain_sig(sig),
+                          &frame->sig);
        if (err)
                goto give_sigsegv;
 
@@ -929,25 +929,24 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
                goto give_sigsegv;
 
         for(i = 1; i < TARGET_NSIG_WORDS; i++) {
-            if (__put_user(set->sig[i], &frame->extramask[i - 1]))
-                goto give_sigsegv;
+            __put_user(set->sig[i], &frame->extramask[i - 1]);
         }
 
        /* Set up to return from userspace.  If provided, use a stub
           already in userspace.  */
        if (ka->sa_flags & TARGET_SA_RESTORER) {
-               err |= __put_user(ka->sa_restorer, &frame->pretcode);
+               __put_user(ka->sa_restorer, &frame->pretcode);
        } else {
                 uint16_t val16;
                 abi_ulong retcode_addr;
                 retcode_addr = frame_addr + offsetof(struct sigframe, retcode);
-               err |= __put_user(retcode_addr, &frame->pretcode);
+               __put_user(retcode_addr, &frame->pretcode);
                /* This is popl %eax ; movl $,%eax ; int $0x80 */
                 val16 = 0xb858;
-               err |= __put_user(val16, (uint16_t *)(frame->retcode+0));
-               err |= __put_user(TARGET_NR_sigreturn, (int 
*)(frame->retcode+2));
+               __put_user(val16, (uint16_t *)(frame->retcode+0));
+               __put_user(TARGET_NR_sigreturn, (int *)(frame->retcode+2));
                 val16 = 0x80cd;
-               err |= __put_user(val16, (uint16_t *)(frame->retcode+6));
+               __put_user(val16, (uint16_t *)(frame->retcode+6));
        }
 
        if (err)
@@ -988,46 +987,45 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
        if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
                goto give_sigsegv;
 
-       err |= __put_user(current_exec_domain_sig(sig),
-                         &frame->sig);
-        addr = frame_addr + offsetof(struct rt_sigframe, info);
-       err |= __put_user(addr, &frame->pinfo);
-        addr = frame_addr + offsetof(struct rt_sigframe, uc);
-       err |= __put_user(addr, &frame->puc);
+       __put_user(current_exec_domain_sig(sig),
+                          &frame->sig);
+       addr = frame_addr + offsetof(struct rt_sigframe, info);
+       __put_user(addr, &frame->pinfo);
+       addr = frame_addr + offsetof(struct rt_sigframe, uc);
+       __put_user(addr, &frame->puc);
        err |= copy_siginfo_to_user(&frame->info, info);
        if (err)
                goto give_sigsegv;
 
        /* Create the ucontext.  */
-       err |= __put_user(0, &frame->uc.tuc_flags);
-       err |= __put_user(0, &frame->uc.tuc_link);
-       err |= __put_user(target_sigaltstack_used.ss_sp,
-                         &frame->uc.tuc_stack.ss_sp);
-       err |= __put_user(sas_ss_flags(get_sp_from_cpustate(env)),
-                         &frame->uc.tuc_stack.ss_flags);
-       err |= __put_user(target_sigaltstack_used.ss_size,
-                         &frame->uc.tuc_stack.ss_size);
+       __put_user(0, &frame->uc.tuc_flags);
+       __put_user(0, &frame->uc.tuc_link);
+       __put_user(target_sigaltstack_used.ss_sp,
+                          &frame->uc.tuc_stack.ss_sp);
+       __put_user(sas_ss_flags(get_sp_from_cpustate(env)),
+                          &frame->uc.tuc_stack.ss_flags);
+       __put_user(target_sigaltstack_used.ss_size,
+                          &frame->uc.tuc_stack.ss_size);
        err |= setup_sigcontext(&frame->uc.tuc_mcontext, &frame->fpstate,
                                env, set->sig[0], 
                                 frame_addr + offsetof(struct rt_sigframe, 
fpstate));
         for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-            if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))
-                goto give_sigsegv;
+            __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
         }
 
        /* Set up to return from userspace.  If provided, use a stub
           already in userspace.  */
        if (ka->sa_flags & TARGET_SA_RESTORER) {
-               err |= __put_user(ka->sa_restorer, &frame->pretcode);
+               __put_user(ka->sa_restorer, &frame->pretcode);
        } else {
                 uint16_t val16;
                 addr = frame_addr + offsetof(struct rt_sigframe, retcode);
-               err |= __put_user(addr, &frame->pretcode);
+               __put_user(addr, &frame->pretcode);
                /* This is movl $,%eax ; int $0x80 */
-                err |= __put_user(0xb8, (char *)(frame->retcode+0));
-               err |= __put_user(TARGET_NR_rt_sigreturn, (int 
*)(frame->retcode+1));
-                val16 = 0x80cd;
-                err |= __put_user(val16, (uint16_t *)(frame->retcode+5));
+               __put_user(0xb8, (char *)(frame->retcode+0));
+               __put_user(TARGET_NR_rt_sigreturn, (int *)(frame->retcode+1));
+               val16 = 0x80cd;
+               __put_user(val16, (uint16_t *)(frame->retcode+5));
        }
 
        if (err)
@@ -1641,8 +1639,7 @@ setup_return(CPUARMState *env, struct target_sigaction 
*ka,
                if (ka->sa_flags & TARGET_SA_SIGINFO)
                        idx += 2;
 
-               if (__put_user(retcodes[idx], rc))
-                       return 1;
+               __put_user(retcodes[idx], rc);
 
                retcode = rc_addr + thumb;
        }
@@ -1740,15 +1737,13 @@ static void setup_frame_v1(int usig, struct 
target_sigaction *ka,
 
        setup_sigcontext(&frame->sc, regs, set->sig[0]);
 
-        for(i = 1; i < TARGET_NSIG_WORDS; i++) {
-            if (__put_user(set->sig[i], &frame->extramask[i - 1]))
-                goto end;
-       }
+    for (i = 1; i < TARGET_NSIG_WORDS; i++) {
+        __put_user(set->sig[i], &frame->extramask[i - 1]);
+    }
 
-        setup_return(regs, ka, &frame->retcode, frame_addr, usig,
-                     frame_addr + offsetof(struct sigframe_v1, retcode));
+    setup_return(regs, ka, &frame->retcode, frame_addr, usig,
+                 frame_addr + offsetof(struct sigframe_v1, retcode));
 
-end:
        unlock_user_struct(frame, frame_addr, 1);
 }
 
@@ -1809,18 +1804,16 @@ static void setup_rt_frame_v1(int usig, struct 
target_sigaction *ka,
         memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack));
 
        setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]);
-        for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-            if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))
-                goto end;
-        }
+    for (i = 0; i < TARGET_NSIG_WORDS; i++) {
+        __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
+    }
 
-        setup_return(env, ka, &frame->retcode, frame_addr, usig,
-                     frame_addr + offsetof(struct rt_sigframe_v1, retcode));
+    setup_return(env, ka, &frame->retcode, frame_addr, usig,
+                 frame_addr + offsetof(struct rt_sigframe_v1, retcode));
 
-        env->regs[1] = info_addr;
-        env->regs[2] = uc_addr;
+    env->regs[1] = info_addr;
+    env->regs[2] = uc_addr;
 
-end:
        unlock_user_struct(frame, frame_addr, 1);
 }
 
@@ -2276,17 +2269,17 @@ setup___siginfo(__siginfo_t *si, CPUSPARCState *env, 
abi_ulong mask)
 {
        int err = 0, i;
 
-       err |= __put_user(env->psr, &si->si_regs.psr);
-       err |= __put_user(env->pc, &si->si_regs.pc);
-       err |= __put_user(env->npc, &si->si_regs.npc);
-       err |= __put_user(env->y, &si->si_regs.y);
+       __put_user(env->psr, &si->si_regs.psr);
+       __put_user(env->pc, &si->si_regs.pc);
+       __put_user(env->npc, &si->si_regs.npc);
+       __put_user(env->y, &si->si_regs.y);
        for (i=0; i < 8; i++) {
-               err |= __put_user(env->gregs[i], &si->si_regs.u_regs[i]);
+               __put_user(env->gregs[i], &si->si_regs.u_regs[i]);
        }
        for (i=0; i < 8; i++) {
-               err |= __put_user(env->regwptr[UREG_I0 + i], 
&si->si_regs.u_regs[i+8]);
+               __put_user(env->regwptr[UREG_I0 + i], &si->si_regs.u_regs[i+8]);
        }
-       err |= __put_user(mask, &si->si_mask);
+       __put_user(mask, &si->si_mask);
        return err;
 }
 
@@ -2297,13 +2290,13 @@ setup_sigcontext(struct target_sigcontext *sc, /*struct 
_fpstate *fpstate,*/
 {
        int err = 0;
 
-       err |= __put_user(mask, &sc->sigc_mask);
-       err |= __put_user(env->regwptr[UREG_SP], &sc->sigc_sp);
-       err |= __put_user(env->pc, &sc->sigc_pc);
-       err |= __put_user(env->npc, &sc->sigc_npc);
-       err |= __put_user(env->psr, &sc->sigc_psr);
-       err |= __put_user(env->gregs[1], &sc->sigc_g1);
-       err |= __put_user(env->regwptr[UREG_O0], &sc->sigc_o0);
+       __put_user(mask, &sc->sigc_mask);
+       __put_user(env->regwptr[UREG_SP], &sc->sigc_sp);
+       __put_user(env->pc, &sc->sigc_pc);
+       __put_user(env->npc, &sc->sigc_npc);
+       __put_user(env->psr, &sc->sigc_psr);
+       __put_user(env->gregs[1], &sc->sigc_g1);
+       __put_user(env->regwptr[UREG_O0], &sc->sigc_o0);
 
        return err;
 }
@@ -2335,21 +2328,21 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
 #endif
        /* 2. Save the current process state */
        err = setup___siginfo(&sf->info, env, set->sig[0]);
-       err |= __put_user(0, &sf->extra_size);
+       __put_user(0, &sf->extra_size);
 
        //err |= save_fpu_state(regs, &sf->fpu_state);
-       //err |= __put_user(&sf->fpu_state, &sf->fpu_save);
+       //__put_user(&sf->fpu_state, &sf->fpu_save);
 
-       err |= __put_user(set->sig[0], &sf->info.si_mask);
+       __put_user(set->sig[0], &sf->info.si_mask);
        for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) {
-               err |= __put_user(set->sig[i + 1], &sf->extramask[i]);
+               __put_user(set->sig[i + 1], &sf->extramask[i]);
        }
 
        for (i = 0; i < 8; i++) {
-               err |= __put_user(env->regwptr[i + UREG_L0], &sf->ss.locals[i]);
+               __put_user(env->regwptr[i + UREG_L0], &sf->ss.locals[i]);
        }
        for (i = 0; i < 8; i++) {
-               err |= __put_user(env->regwptr[i + UREG_I0], &sf->ss.ins[i]);
+               __put_user(env->regwptr[i + UREG_I0], &sf->ss.ins[i]);
        }
        if (err)
                goto sigsegv;
@@ -2376,11 +2369,11 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
 
                /* mov __NR_sigreturn, %g1 */
                 val32 = 0x821020d8;
-               err |= __put_user(val32, &sf->insns[0]);
+               __put_user(val32, &sf->insns[0]);
 
                /* t 0x10 */
                 val32 = 0x91d02010;
-               err |= __put_user(val32, &sf->insns[1]);
+               __put_user(val32, &sf->insns[1]);
                if (err)
                        goto sigsegv;
 
@@ -2720,39 +2713,39 @@ void sparc64_get_context(CPUSPARCState *env)
     do_sigprocmask(0, NULL, &set);
     host_to_target_sigset_internal(&target_set, &set);
     if (TARGET_NSIG_WORDS == 1) {
-        err |= __put_user(target_set.sig[0],
-                          (abi_ulong *)&ucp->tuc_sigmask);
+        __put_user(target_set.sig[0],
+                   (abi_ulong *)&ucp->tuc_sigmask);
     } else {
         abi_ulong *src, *dst;
         src = target_set.sig;
         dst = ucp->tuc_sigmask.sig;
         for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) {
-            err |= __put_user(*src, dst);
+             __put_user(*src, dst);
         }
         if (err)
             goto do_sigsegv;
     }
 
     /* XXX: tstate must be saved properly */
-    //    err |= __put_user(env->tstate, &((*grp)[MC_TSTATE]));
-    err |= __put_user(env->pc, &((*grp)[MC_PC]));
-    err |= __put_user(env->npc, &((*grp)[MC_NPC]));
-    err |= __put_user(env->y, &((*grp)[MC_Y]));
-    err |= __put_user(env->gregs[1], &((*grp)[MC_G1]));
-    err |= __put_user(env->gregs[2], &((*grp)[MC_G2]));
-    err |= __put_user(env->gregs[3], &((*grp)[MC_G3]));
-    err |= __put_user(env->gregs[4], &((*grp)[MC_G4]));
-    err |= __put_user(env->gregs[5], &((*grp)[MC_G5]));
-    err |= __put_user(env->gregs[6], &((*grp)[MC_G6]));
-    err |= __put_user(env->gregs[7], &((*grp)[MC_G7]));
-    err |= __put_user(env->regwptr[UREG_I0], &((*grp)[MC_O0]));
-    err |= __put_user(env->regwptr[UREG_I1], &((*grp)[MC_O1]));
-    err |= __put_user(env->regwptr[UREG_I2], &((*grp)[MC_O2]));
-    err |= __put_user(env->regwptr[UREG_I3], &((*grp)[MC_O3]));
-    err |= __put_user(env->regwptr[UREG_I4], &((*grp)[MC_O4]));
-    err |= __put_user(env->regwptr[UREG_I5], &((*grp)[MC_O5]));
-    err |= __put_user(env->regwptr[UREG_I6], &((*grp)[MC_O6]));
-    err |= __put_user(env->regwptr[UREG_I7], &((*grp)[MC_O7]));
+    //    __put_user(env->tstate, &((*grp)[MC_TSTATE]));
+    __put_user(env->pc, &((*grp)[MC_PC]));
+    __put_user(env->npc, &((*grp)[MC_NPC]));
+    __put_user(env->y, &((*grp)[MC_Y]));
+    __put_user(env->gregs[1], &((*grp)[MC_G1]));
+    __put_user(env->gregs[2], &((*grp)[MC_G2]));
+    __put_user(env->gregs[3], &((*grp)[MC_G3]));
+    __put_user(env->gregs[4], &((*grp)[MC_G4]));
+    __put_user(env->gregs[5], &((*grp)[MC_G5]));
+    __put_user(env->gregs[6], &((*grp)[MC_G6]));
+    __put_user(env->gregs[7], &((*grp)[MC_G7]));
+    __put_user(env->regwptr[UREG_I0], &((*grp)[MC_O0]));
+    __put_user(env->regwptr[UREG_I1], &((*grp)[MC_O1]));
+    __put_user(env->regwptr[UREG_I2], &((*grp)[MC_O2]));
+    __put_user(env->regwptr[UREG_I3], &((*grp)[MC_O3]));
+    __put_user(env->regwptr[UREG_I4], &((*grp)[MC_O4]));
+    __put_user(env->regwptr[UREG_I5], &((*grp)[MC_O5]));
+    __put_user(env->regwptr[UREG_I6], &((*grp)[MC_O6]));
+    __put_user(env->regwptr[UREG_I7], &((*grp)[MC_O7]));
 
     w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6];
     fp = i7 = 0;
@@ -2762,22 +2755,22 @@ void sparc64_get_context(CPUSPARCState *env)
     if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), 
                  abi_ulong) != 0)
         goto do_sigsegv;
-    err |= __put_user(fp, &(mcp->mc_fp));
-    err |= __put_user(i7, &(mcp->mc_i7));
+    __put_user(fp, &(mcp->mc_fp));
+    __put_user(i7, &(mcp->mc_i7));
 
     {
         uint32_t *dst = ucp->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs;
         for (i = 0; i < 64; i++, dst++) {
             if (i & 1) {
-                err |= __put_user(env->fpr[i/2].l.lower, dst);
+                __put_user(env->fpr[i/2].l.lower, dst);
             } else {
-                err |= __put_user(env->fpr[i/2].l.upper, dst);
+                __put_user(env->fpr[i/2].l.upper, dst);
             }
         }
     }
-    err |= __put_user(env->fsr, &(mcp->mc_fpregs.mcfpu_fsr));
-    err |= __put_user(env->gsr, &(mcp->mc_fpregs.mcfpu_gsr));
-    err |= __put_user(env->fprs, &(mcp->mc_fpregs.mcfpu_fprs));
+    __put_user(env->fsr, &(mcp->mc_fpregs.mcfpu_fsr));
+    __put_user(env->gsr, &(mcp->mc_fpregs.mcfpu_gsr));
+    __put_user(env->fprs, &(mcp->mc_fpregs.mcfpu_fprs));
 
     if (err)
         goto do_sigsegv;
@@ -2867,8 +2860,8 @@ static inline int install_sigtramp(unsigned int *tramp,   
unsigned int syscall)
      *         syscall
      */
 
-    err |= __put_user(0x24020000 + syscall, tramp + 0);
-    err |= __put_user(0x0000000c          , tramp + 1);
+    __put_user(0x24020000 + syscall, tramp + 0);
+    __put_user(0x0000000c          , tramp + 1);
     return err;
 }
 
@@ -2878,34 +2871,34 @@ setup_sigcontext(CPUMIPSState *regs, struct 
target_sigcontext *sc)
     int err = 0;
     int i;
 
-    err |= __put_user(exception_resume_pc(regs), &sc->sc_pc);
+    __put_user(exception_resume_pc(regs), &sc->sc_pc);
     regs->hflags &= ~MIPS_HFLAG_BMASK;
 
     __put_user(0, &sc->sc_regs[0]);
     for (i = 1; i < 32; ++i) {
-        err |= __put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
+        __put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
     }
 
-    err |= __put_user(regs->active_tc.HI[0], &sc->sc_mdhi);
-    err |= __put_user(regs->active_tc.LO[0], &sc->sc_mdlo);
+    __put_user(regs->active_tc.HI[0], &sc->sc_mdhi);
+    __put_user(regs->active_tc.LO[0], &sc->sc_mdlo);
 
     /* Rather than checking for dsp existence, always copy.  The storage
        would just be garbage otherwise.  */
-    err |= __put_user(regs->active_tc.HI[1], &sc->sc_hi1);
-    err |= __put_user(regs->active_tc.HI[2], &sc->sc_hi2);
-    err |= __put_user(regs->active_tc.HI[3], &sc->sc_hi3);
-    err |= __put_user(regs->active_tc.LO[1], &sc->sc_lo1);
-    err |= __put_user(regs->active_tc.LO[2], &sc->sc_lo2);
-    err |= __put_user(regs->active_tc.LO[3], &sc->sc_lo3);
+    __put_user(regs->active_tc.HI[1], &sc->sc_hi1);
+    __put_user(regs->active_tc.HI[2], &sc->sc_hi2);
+    __put_user(regs->active_tc.HI[3], &sc->sc_hi3);
+    __put_user(regs->active_tc.LO[1], &sc->sc_lo1);
+    __put_user(regs->active_tc.LO[2], &sc->sc_lo2);
+    __put_user(regs->active_tc.LO[3], &sc->sc_lo3);
     {
         uint32_t dsp = cpu_rddsp(0x3ff, regs);
-        err |= __put_user(dsp, &sc->sc_dsp);
+        __put_user(dsp, &sc->sc_dsp);
     }
 
-    err |= __put_user(1, &sc->sc_used_math);
+    __put_user(1, &sc->sc_used_math);
 
     for (i = 0; i < 32; ++i) {
-        err |= __put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
+        __put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
     }
 
     return err;
@@ -2999,8 +2992,7 @@ static void setup_frame(int sig, struct target_sigaction 
* ka,
        goto give_sigsegv;
 
     for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-       if(__put_user(set->sig[i], &frame->sf_mask.sig[i]))
-           goto give_sigsegv;
+       __put_user(set->sig[i], &frame->sf_mask.sig[i]);
     }
 
     /*
@@ -3249,7 +3241,7 @@ static int setup_sigcontext(struct target_sigcontext *sc,
     int err = 0;
     int i;
 
-#define COPY(x)         err |= __put_user(regs->x, &sc->sc_##x)
+#define COPY(x)         __put_user(regs->x, &sc->sc_##x)
     COPY(gregs[0]); COPY(gregs[1]);
     COPY(gregs[2]); COPY(gregs[3]);
     COPY(gregs[4]); COPY(gregs[5]);
@@ -3264,13 +3256,13 @@ static int setup_sigcontext(struct target_sigcontext 
*sc,
 #undef COPY
 
     for (i=0; i<16; i++) {
-        err |= __put_user(regs->fregs[i], &sc->sc_fpregs[i]);
+        __put_user(regs->fregs[i], &sc->sc_fpregs[i]);
     }
-    err |= __put_user(regs->fpscr, &sc->sc_fpscr);
-    err |= __put_user(regs->fpul, &sc->sc_fpul);
+     __put_user(regs->fpscr, &sc->sc_fpscr);
+     __put_user(regs->fpul, &sc->sc_fpul);
 
     /* non-iBCS2 extensions.. */
-    err |= __put_user(mask, &sc->oldmask);
+    __put_user(mask, &sc->oldmask);
 
     return err;
 }
@@ -3324,7 +3316,7 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
     err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
 
     for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) {
-        err |= __put_user(set->sig[i + 1], &frame->extramask[i]);
+        __put_user(set->sig[i + 1], &frame->extramask[i]);
     }
 
     /* Set up to return from userspace.  If provided, use a stub
@@ -3333,9 +3325,9 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
         regs->pr = (unsigned long) ka->sa_restorer;
     } else {
         /* Generate return code (system call to sigreturn) */
-        err |= __put_user(MOVW(2), &frame->retcode[0]);
-        err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
-        err |= __put_user((TARGET_NR_sigreturn), &frame->retcode[2]);
+        __put_user(MOVW(2), &frame->retcode[0]);
+        __put_user(TRAP_NOARG, &frame->retcode[1]);
+        __put_user((TARGET_NR_sigreturn), &frame->retcode[2]);
         regs->pr = (unsigned long) frame->retcode;
     }
 
@@ -3376,18 +3368,18 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
     err |= copy_siginfo_to_user(&frame->info, info);
 
     /* Create the ucontext.  */
-    err |= __put_user(0, &frame->uc.tuc_flags);
-    err |= __put_user(0, (unsigned long *)&frame->uc.tuc_link);
-    err |= __put_user((unsigned long)target_sigaltstack_used.ss_sp,
-                     &frame->uc.tuc_stack.ss_sp);
-    err |= __put_user(sas_ss_flags(regs->gregs[15]),
-                     &frame->uc.tuc_stack.ss_flags);
-    err |= __put_user(target_sigaltstack_used.ss_size,
-                     &frame->uc.tuc_stack.ss_size);
+    __put_user(0, &frame->uc.tuc_flags);
+    __put_user(0, (unsigned long *)&frame->uc.tuc_link);
+    __put_user((unsigned long)target_sigaltstack_used.ss_sp,
+          &frame->uc.tuc_stack.ss_sp);
+    __put_user(sas_ss_flags(regs->gregs[15]),
+          &frame->uc.tuc_stack.ss_flags);
+    __put_user(target_sigaltstack_used.ss_size,
+          &frame->uc.tuc_stack.ss_size);
     err |= setup_sigcontext(&frame->uc.tuc_mcontext,
                            regs, set->sig[0]);
     for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-        err |= __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
+        __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
     }
 
     /* Set up to return from userspace.  If provided, use a stub
@@ -3396,9 +3388,9 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
         regs->pr = (unsigned long) ka->sa_restorer;
     } else {
         /* Generate return code (system call to sigreturn) */
-        err |= __put_user(MOVW(2), &frame->retcode[0]);
-        err |= __put_user(TRAP_NOARG, &frame->retcode[1]);
-        err |= __put_user((TARGET_NR_rt_sigreturn), &frame->retcode[2]);
+        __put_user(MOVW(2), &frame->retcode[0]);
+        __put_user(TRAP_NOARG, &frame->retcode[1]);
+        __put_user((TARGET_NR_rt_sigreturn), &frame->retcode[2]);
         regs->pr = (unsigned long) frame->retcode;
     }
 
@@ -3625,13 +3617,12 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
         goto badframe;
 
     /* Save the mask.  */
-    err |= __put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask);
+    __put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask);
     if (err)
         goto badframe;
 
     for(i = 1; i < TARGET_NSIG_WORDS; i++) {
-        if (__put_user(set->sig[i], &frame->extramask[i - 1]))
-            goto badframe;
+        __put_user(set->sig[i], &frame->extramask[i - 1]);
     }
 
     setup_sigcontext(&frame->uc.tuc_mcontext, env);
@@ -3646,10 +3637,10 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
         /* Note, these encodings are _big endian_! */
         /* addi r12, r0, __NR_sigreturn */
         t = 0x31800000UL | TARGET_NR_sigreturn;
-        err |= __put_user(t, frame->tramp + 0);
+        __put_user(t, frame->tramp + 0);
         /* brki r14, 0x8 */
         t = 0xb9cc0008UL;
-        err |= __put_user(t, frame->tramp + 1);
+        __put_user(t, frame->tramp + 1);
 
         /* Return from sighandler will jump to the tramp.
            Negative 8 offset because return is rtsd r15, 8 */
@@ -3807,7 +3798,6 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
 {
        struct target_signal_frame *frame;
        abi_ulong frame_addr;
-       int err = 0;
        int i;
 
        frame_addr = get_sigframe(env, sizeof *frame);
@@ -3821,19 +3811,16 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
         *
         * This is movu.w __NR_sigreturn, r9; break 13;
         */
-       err |= __put_user(0x9c5f, frame->retcode+0);
-       err |= __put_user(TARGET_NR_sigreturn, 
-                         frame->retcode + 1);
-       err |= __put_user(0xe93d, frame->retcode + 2);
+       __put_user(0x9c5f, frame->retcode+0);
+       __put_user(TARGET_NR_sigreturn,
+          frame->retcode + 1);
+       __put_user(0xe93d, frame->retcode + 2);
 
        /* Save the mask.  */
-       err |= __put_user(set->sig[0], &frame->sc.oldmask);
-       if (err)
-               goto badframe;
+       __put_user(set->sig[0], &frame->sc.oldmask);
 
        for(i = 1; i < TARGET_NSIG_WORDS; i++) {
-               if (__put_user(set->sig[i], &frame->extramask[i - 1]))
-                       goto badframe;
+        __put_user(set->sig[i], &frame->extramask[i - 1]);
        }
 
        setup_sigcontext(&frame->sc, env);
@@ -3988,8 +3975,9 @@ static int setup_sigcontext(struct target_sigcontext *sc,
     /*regs->frametype = CRIS_FRAME_NORMAL;*/
 
     /* then some other stuff */
-    err |= __put_user(mask, &sc->oldmask);
-    err |= __put_user(usp, &sc->usp); return err;
+    __put_user(mask, &sc->oldmask);
+    __put_user(usp, &sc->usp);
+       return err;
 }
 
 static inline unsigned long align_sigframe(unsigned long sp)
@@ -4048,9 +4036,9 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
     }
 
     info_addr = frame_addr + offsetof(struct target_rt_sigframe, info);
-    err |= __put_user(info_addr, &frame->pinfo);
+    __put_user(info_addr, &frame->pinfo);
     uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);
-    err |= __put_user(uc_addr, &frame->puc);
+    __put_user(uc_addr, &frame->puc);
 
     if (ka->sa_flags & SA_SIGINFO) {
         err |= copy_siginfo_to_user(&frame->info, info);
@@ -4060,13 +4048,13 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
     }
 
     /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, 
uc_mcontext));*/
-    err |= __put_user(0, &frame->uc.tuc_flags);
-    err |= __put_user(0, &frame->uc.tuc_link);
-    err |= __put_user(target_sigaltstack_used.ss_sp,
-                      &frame->uc.tuc_stack.ss_sp);
-    err |= __put_user(sas_ss_flags(env->gpr[1]), 
&frame->uc.tuc_stack.ss_flags);
-    err |= __put_user(target_sigaltstack_used.ss_size,
-                      &frame->uc.tuc_stack.ss_size);
+    __put_user(0, &frame->uc.tuc_flags);
+    __put_user(0, &frame->uc.tuc_link);
+    __put_user(target_sigaltstack_used.ss_sp,
+               &frame->uc.tuc_stack.ss_sp);
+    __put_user(sas_ss_flags(env->gpr[1]), &frame->uc.tuc_stack.ss_flags);
+    __put_user(target_sigaltstack_used.ss_size,
+               &frame->uc.tuc_stack.ss_size);
     err |= setup_sigcontext(&frame->sc, env, set->sig[0]);
 
     /*err |= copy_to_user(frame->uc.tuc_sigmask, set, sizeof(*set));*/
@@ -4078,10 +4066,10 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
     /* trampoline - the desired return ip is the retcode itself */
     return_ip = (unsigned long)&frame->retcode;
     /* This is l.ori r11,r0,__NR_sigreturn, l.sys 1 */
-    err |= __put_user(0xa960, (short *)(frame->retcode + 0));
-    err |= __put_user(TARGET_NR_rt_sigreturn, (short *)(frame->retcode + 2));
-    err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4));
-    err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8));
+    __put_user(0xa960, (short *)(frame->retcode + 0));
+    __put_user(TARGET_NR_rt_sigreturn, (short *)(frame->retcode + 2));
+    __put_user(0x20000001, (unsigned long *)(frame->retcode + 4));
+    __put_user(0x15000000, (unsigned long *)(frame->retcode + 8));
 
     if (err) {
         goto give_sigsegv;
@@ -4248,9 +4236,7 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
     }
 
     qemu_log("%s: 1\n", __FUNCTION__);
-    if (__put_user(set->sig[0], &frame->sc.oldmask[0])) {
-              goto give_sigsegv;
-    }
+    __put_user(set->sig[0], &frame->sc.oldmask[0]);
 
     save_sigregs(env, &frame->sregs);
 
@@ -4265,15 +4251,12 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
     } else {
             env->regs[14] = (unsigned long)
                     frame->retcode | PSW_ADDR_AMODE;
-            if (__put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
-                           (uint16_t *)(frame->retcode)))
-                    goto give_sigsegv;
+            __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
+                                          (uint16_t *)(frame->retcode));
     }
 
     /* Set up backchain. */
-    if (__put_user(env->regs[15], (abi_ulong *) frame)) {
-            goto give_sigsegv;
-    }
+    __put_user(env->regs[15], (abi_ulong *) frame);
 
     /* Set up registers for signal handler */
     env->regs[15] = frame_addr;
@@ -4288,9 +4271,7 @@ static void setup_frame(int sig, struct target_sigaction 
*ka,
     env->regs[5] = 0; // FIXME: no clue... current->thread.prot_addr;
 
     /* Place signal number on stack to allow backtrace from handler.  */
-    if (__put_user(env->regs[2], (int *) &frame->signo)) {
-            goto give_sigsegv;
-    }
+    __put_user(env->regs[2], (int *) &frame->signo);
     unlock_user_struct(frame, frame_addr, 1);
     return;
 
@@ -4339,16 +4320,12 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
         env->regs[14] = (unsigned long) ka->sa_restorer | PSW_ADDR_AMODE;
     } else {
         env->regs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE;
-        if (__put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
-                       (uint16_t *)(frame->retcode))) {
-            goto give_sigsegv;
-        }
+        __put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
+                   (uint16_t *)(frame->retcode));
     }
 
     /* Set up backchain. */
-    if (__put_user(env->regs[15], (abi_ulong *) frame)) {
-        goto give_sigsegv;
-    }
+    __put_user(env->regs[15], (abi_ulong *) frame);
 
     /* Set up registers for signal handler */
     env->regs[15] = frame_addr;
@@ -4635,21 +4612,17 @@ static int save_user_regs(CPUPPCState *env, struct 
target_mcontext *frame,
 
     /* Save general registers.  */
     for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
-        if (__put_user(env->gpr[i], &frame->mc_gregs[i])) {
-            return 1;
-        }
+        __put_user(env->gpr[i], &frame->mc_gregs[i]);
     }
-    if (__put_user(env->nip, &frame->mc_gregs[TARGET_PT_NIP])
-        || __put_user(env->ctr, &frame->mc_gregs[TARGET_PT_CTR])
-        || __put_user(env->lr, &frame->mc_gregs[TARGET_PT_LNK])
-        || __put_user(env->xer, &frame->mc_gregs[TARGET_PT_XER]))
-        return 1;
+    __put_user(env->nip, &frame->mc_gregs[TARGET_PT_NIP]);
+    __put_user(env->ctr, &frame->mc_gregs[TARGET_PT_CTR]);
+    __put_user(env->lr, &frame->mc_gregs[TARGET_PT_LNK]);
+    __put_user(env->xer, &frame->mc_gregs[TARGET_PT_XER]);
 
     for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
         ccr |= env->crf[i] << (32 - ((i + 1) * 4));
     }
-    if (__put_user(ccr, &frame->mc_gregs[TARGET_PT_CCR]))
-        return 1;
+    __put_user(ccr, &frame->mc_gregs[TARGET_PT_CCR]);
 
     /* Save Altivec registers if necessary.  */
     if (env->insns_flags & PPC_ALTIVEC) {
@@ -4657,62 +4630,48 @@ static int save_user_regs(CPUPPCState *env, struct 
target_mcontext *frame,
             ppc_avr_t *avr = &env->avr[i];
             ppc_avr_t *vreg = &frame->mc_vregs.altivec[i];
 
-            if (__put_user(avr->u64[0], &vreg->u64[0]) ||
-                __put_user(avr->u64[1], &vreg->u64[1])) {
-                return 1;
-            }
+            __put_user(avr->u64[0], &vreg->u64[0]);
+            __put_user(avr->u64[1], &vreg->u64[1]);
         }
         /* Set MSR_VR in the saved MSR value to indicate that
            frame->mc_vregs contains valid data.  */
         msr |= MSR_VR;
-        if (__put_user((uint32_t)env->spr[SPR_VRSAVE],
-                       &frame->mc_vregs.altivec[32].u32[3]))
-            return 1;
+        __put_user((uint32_t)env->spr[SPR_VRSAVE],
+                   &frame->mc_vregs.altivec[32].u32[3]);
     }
 
     /* Save floating point registers.  */
     if (env->insns_flags & PPC_FLOAT) {
         for (i = 0; i < ARRAY_SIZE(env->fpr); i++) {
-            if (__put_user(env->fpr[i], &frame->mc_fregs[i])) {
-                return 1;
-            }
+            __put_user(env->fpr[i], &frame->mc_fregs[i]);
         }
-        if (__put_user((uint64_t) env->fpscr, &frame->mc_fregs[32]))
-            return 1;
+        __put_user((uint64_t) env->fpscr, &frame->mc_fregs[32]);
     }
 
     /* Save SPE registers.  The kernel only saves the high half.  */
     if (env->insns_flags & PPC_SPE) {
 #if defined(TARGET_PPC64)
         for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
-            if (__put_user(env->gpr[i] >> 32, &frame->mc_vregs.spe[i])) {
-                return 1;
-            }
+            __put_user(env->gpr[i] >> 32, &frame->mc_vregs.spe[i]);
         }
 #else
         for (i = 0; i < ARRAY_SIZE(env->gprh); i++) {
-            if (__put_user(env->gprh[i], &frame->mc_vregs.spe[i])) {
-                return 1;
-            }
+            __put_user(env->gprh[i], &frame->mc_vregs.spe[i]);
         }
 #endif
         /* Set MSR_SPE in the saved MSR value to indicate that
            frame->mc_vregs contains valid data.  */
         msr |= MSR_SPE;
-        if (__put_user(env->spe_fscr, &frame->mc_vregs.spe[32]))
-            return 1;
+        __put_user(env->spe_fscr, &frame->mc_vregs.spe[32]);
     }
 
     /* Store MSR.  */
-    if (__put_user(msr, &frame->mc_gregs[TARGET_PT_MSR]))
-        return 1;
+    __put_user(msr, &frame->mc_gregs[TARGET_PT_MSR]);
 
     /* Set up the sigreturn trampoline: li r0,sigret; sc.  */
     if (sigret) {
-        if (__put_user(0x38000000UL | sigret, &frame->tramp[0]) ||
-            __put_user(0x44000002UL, &frame->tramp[1])) {
-            return 1;
-        }
+        __put_user(0x38000000UL | sigret, &frame->tramp[0]);
+        __put_user(0x44000002UL, &frame->tramp[1]);
     }
 
     return 0;
@@ -4832,15 +4791,15 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
 
     signal = current_exec_domain_sig(sig);
 
-    err |= __put_user(ka->_sa_handler, &sc->handler);
-    err |= __put_user(set->sig[0], &sc->oldmask);
+    __put_user(ka->_sa_handler, &sc->handler);
+    __put_user(set->sig[0], &sc->oldmask);
 #if defined(TARGET_PPC64)
-    err |= __put_user(set->sig[0] >> 32, &sc->_unused[3]);
+    __put_user(set->sig[0] >> 32, &sc->_unused[3]);
 #else
-    err |= __put_user(set->sig[1], &sc->_unused[3]);
+    __put_user(set->sig[1], &sc->_unused[3]);
 #endif
-    err |= __put_user(h2g(&frame->mctx), &sc->regs);
-    err |= __put_user(sig, &sc->signal);
+    __put_user(h2g(&frame->mctx), &sc->regs);
+    __put_user(sig, &sc->signal);
 
     /* Save user regs.  */
     err |= save_user_regs(env, &frame->mctx, TARGET_NR_sigreturn);
@@ -4894,18 +4853,18 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
 
     err |= copy_siginfo_to_user(&rt_sf->info, info);
 
-    err |= __put_user(0, &rt_sf->uc.tuc_flags);
-    err |= __put_user(0, &rt_sf->uc.tuc_link);
-    err |= __put_user((target_ulong)target_sigaltstack_used.ss_sp,
-                      &rt_sf->uc.tuc_stack.ss_sp);
-    err |= __put_user(sas_ss_flags(env->gpr[1]),
-                      &rt_sf->uc.tuc_stack.ss_flags);
-    err |= __put_user(target_sigaltstack_used.ss_size,
-                      &rt_sf->uc.tuc_stack.ss_size);
-    err |= __put_user(h2g (&rt_sf->uc.tuc_mcontext),
-                      &rt_sf->uc.tuc_regs);
+    __put_user(0, &rt_sf->uc.tuc_flags);
+    __put_user(0, &rt_sf->uc.tuc_link);
+    __put_user((target_ulong)target_sigaltstack_used.ss_sp,
+               &rt_sf->uc.tuc_stack.ss_sp);
+    __put_user(sas_ss_flags(env->gpr[1]),
+               &rt_sf->uc.tuc_stack.ss_flags);
+    __put_user(target_sigaltstack_used.ss_size,
+               &rt_sf->uc.tuc_stack.ss_size);
+    __put_user(h2g (&rt_sf->uc.tuc_mcontext),
+               &rt_sf->uc.tuc_regs);
     for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-        err |= __put_user(set->sig[i], &rt_sf->uc.tuc_sigmask.sig[i]);
+        __put_user(set->sig[i], &rt_sf->uc.tuc_sigmask.sig[i]);
     }
 
     frame = &rt_sf->uc.tuc_mcontext;
@@ -4920,7 +4879,7 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
 
     /* Create a stack frame for the caller of the handler.  */
     newsp = rt_sf_addr - (SIGNAL_FRAMESIZE + 16);
-    err |= __put_user(env->gpr[1], (target_ulong *)(uintptr_t) newsp);
+    __put_user(env->gpr[1], (target_ulong *)(uintptr_t) newsp);
 
     if (err)
         goto sigsegv;
@@ -5115,14 +5074,14 @@ setup_sigcontext(struct target_sigcontext *sc, 
CPUM68KState *env,
 {
     int err = 0;
 
-    err |= __put_user(mask, &sc->sc_mask);
-    err |= __put_user(env->aregs[7], &sc->sc_usp);
-    err |= __put_user(env->dregs[0], &sc->sc_d0);
-    err |= __put_user(env->dregs[1], &sc->sc_d1);
-    err |= __put_user(env->aregs[0], &sc->sc_a0);
-    err |= __put_user(env->aregs[1], &sc->sc_a1);
-    err |= __put_user(env->sr, &sc->sc_sr);
-    err |= __put_user(env->pc, &sc->sc_pc);
+    __put_user(mask, &sc->sc_mask);
+    __put_user(env->aregs[7], &sc->sc_usp);
+    __put_user(env->dregs[0], &sc->sc_d0);
+    __put_user(env->dregs[1], &sc->sc_d1);
+    __put_user(env->aregs[0], &sc->sc_a0);
+    __put_user(env->aregs[1], &sc->sc_a1);
+    __put_user(env->sr, &sc->sc_sr);
+    __put_user(env->pc, &sc->sc_pc);
 
     return err;
 }
@@ -5179,29 +5138,28 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
        goto give_sigsegv;
 
-    err |= __put_user(sig, &frame->sig);
+    __put_user(sig, &frame->sig);
 
     sc_addr = frame_addr + offsetof(struct target_sigframe, sc);
-    err |= __put_user(sc_addr, &frame->psc);
+    __put_user(sc_addr, &frame->psc);
 
     err |= setup_sigcontext(&frame->sc, env, set->sig[0]);
     if (err)
        goto give_sigsegv;
 
     for(i = 1; i < TARGET_NSIG_WORDS; i++) {
-        if (__put_user(set->sig[i], &frame->extramask[i - 1]))
-            goto give_sigsegv;
+        __put_user(set->sig[i], &frame->extramask[i - 1]);
     }
 
     /* Set up to return from userspace.  */
 
     retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode);
-    err |= __put_user(retcode_addr, &frame->pretcode);
+    __put_user(retcode_addr, &frame->pretcode);
 
     /* moveq #,d0; trap #0 */
 
-    err |= __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16),
-                      (long *)(frame->retcode));
+    __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16),
+               (long *)(frame->retcode));
 
     if (err)
         goto give_sigsegv;
@@ -5223,27 +5181,27 @@ static inline int target_rt_setup_ucontext(struct 
target_ucontext *uc,
                                            CPUM68KState *env)
 {
     target_greg_t *gregs = uc->tuc_mcontext.gregs;
-    int err;
+    int err = 0;
 
-    err = __put_user(TARGET_MCONTEXT_VERSION, &uc->tuc_mcontext.version);
-    err |= __put_user(env->dregs[0], &gregs[0]);
-    err |= __put_user(env->dregs[1], &gregs[1]);
-    err |= __put_user(env->dregs[2], &gregs[2]);
-    err |= __put_user(env->dregs[3], &gregs[3]);
-    err |= __put_user(env->dregs[4], &gregs[4]);
-    err |= __put_user(env->dregs[5], &gregs[5]);
-    err |= __put_user(env->dregs[6], &gregs[6]);
-    err |= __put_user(env->dregs[7], &gregs[7]);
-    err |= __put_user(env->aregs[0], &gregs[8]);
-    err |= __put_user(env->aregs[1], &gregs[9]);
-    err |= __put_user(env->aregs[2], &gregs[10]);
-    err |= __put_user(env->aregs[3], &gregs[11]);
-    err |= __put_user(env->aregs[4], &gregs[12]);
-    err |= __put_user(env->aregs[5], &gregs[13]);
-    err |= __put_user(env->aregs[6], &gregs[14]);
-    err |= __put_user(env->aregs[7], &gregs[15]);
-    err |= __put_user(env->pc, &gregs[16]);
-    err |= __put_user(env->sr, &gregs[17]);
+    __put_user(TARGET_MCONTEXT_VERSION, &uc->tuc_mcontext.version);
+    __put_user(env->dregs[0], &gregs[0]);
+    __put_user(env->dregs[1], &gregs[1]);
+    __put_user(env->dregs[2], &gregs[2]);
+    __put_user(env->dregs[3], &gregs[3]);
+    __put_user(env->dregs[4], &gregs[4]);
+    __put_user(env->dregs[5], &gregs[5]);
+    __put_user(env->dregs[6], &gregs[6]);
+    __put_user(env->dregs[7], &gregs[7]);
+    __put_user(env->aregs[0], &gregs[8]);
+    __put_user(env->aregs[1], &gregs[9]);
+    __put_user(env->aregs[2], &gregs[10]);
+    __put_user(env->aregs[3], &gregs[11]);
+    __put_user(env->aregs[4], &gregs[12]);
+    __put_user(env->aregs[5], &gregs[13]);
+    __put_user(env->aregs[6], &gregs[14]);
+    __put_user(env->aregs[7], &gregs[15]);
+    __put_user(env->pc, &gregs[16]);
+    __put_user(env->sr, &gregs[17]);
 
     return err;
 }
@@ -5304,46 +5262,45 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
        goto give_sigsegv;
 
-    err |= __put_user(sig, &frame->sig);
+    __put_user(sig, &frame->sig);
 
     info_addr = frame_addr + offsetof(struct target_rt_sigframe, info);
-    err |= __put_user(info_addr, &frame->pinfo);
+    __put_user(info_addr, &frame->pinfo);
 
     uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);
-    err |= __put_user(uc_addr, &frame->puc);
+    __put_user(uc_addr, &frame->puc);
 
-    err |= copy_siginfo_to_user(&frame->info, info);
+    copy_siginfo_to_user(&frame->info, info);
 
     /* Create the ucontext */
 
-    err |= __put_user(0, &frame->uc.tuc_flags);
-    err |= __put_user(0, &frame->uc.tuc_link);
-    err |= __put_user(target_sigaltstack_used.ss_sp,
-                      &frame->uc.tuc_stack.ss_sp);
-    err |= __put_user(sas_ss_flags(env->aregs[7]),
-                      &frame->uc.tuc_stack.ss_flags);
-    err |= __put_user(target_sigaltstack_used.ss_size,
-                      &frame->uc.tuc_stack.ss_size);
+    __put_user(0, &frame->uc.tuc_flags);
+    __put_user(0, &frame->uc.tuc_link);
+    __put_user(target_sigaltstack_used.ss_sp,
+               &frame->uc.tuc_stack.ss_sp);
+    __put_user(sas_ss_flags(env->aregs[7]),
+               &frame->uc.tuc_stack.ss_flags);
+    __put_user(target_sigaltstack_used.ss_size,
+               &frame->uc.tuc_stack.ss_size);
     err |= target_rt_setup_ucontext(&frame->uc, env);
 
     if (err)
             goto give_sigsegv;
 
     for(i = 0; i < TARGET_NSIG_WORDS; i++) {
-        if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))
-            goto give_sigsegv;
+        __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
     }
 
     /* Set up to return from userspace.  */
 
     retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode);
-    err |= __put_user(retcode_addr, &frame->pretcode);
+    __put_user(retcode_addr, &frame->pretcode);
 
     /* moveq #,d0; notb d0; trap #0 */
 
-    err |= __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16),
-                      (long *)(frame->retcode + 0));
-    err |= __put_user(0x4e40, (short *)(frame->retcode + 4));
+    __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16),
+               (long *)(frame->retcode + 0));
+    __put_user(0x4e40, (short *)(frame->retcode + 4));
 
     if (err)
         goto give_sigsegv;
@@ -5485,25 +5442,25 @@ static int setup_sigcontext(struct target_sigcontext 
*sc, CPUAlphaState *env,
 {
     int i, err = 0;
 
-    err |= __put_user(on_sig_stack(frame_addr), &sc->sc_onstack);
-    err |= __put_user(set->sig[0], &sc->sc_mask);
-    err |= __put_user(env->pc, &sc->sc_pc);
-    err |= __put_user(8, &sc->sc_ps);
+    __put_user(on_sig_stack(frame_addr), &sc->sc_onstack);
+    __put_user(set->sig[0], &sc->sc_mask);
+    __put_user(env->pc, &sc->sc_pc);
+    __put_user(8, &sc->sc_ps);
 
     for (i = 0; i < 31; ++i) {
-        err |= __put_user(env->ir[i], &sc->sc_regs[i]);
+        __put_user(env->ir[i], &sc->sc_regs[i]);
     }
-    err |= __put_user(0, &sc->sc_regs[31]);
+    __put_user(0, &sc->sc_regs[31]);
 
     for (i = 0; i < 31; ++i) {
-        err |= __put_user(env->fir[i], &sc->sc_fpregs[i]);
+        __put_user(env->fir[i], &sc->sc_fpregs[i]);
     }
-    err |= __put_user(0, &sc->sc_fpregs[31]);
-    err |= __put_user(cpu_alpha_load_fpcr(env), &sc->sc_fpcr);
+    __put_user(0, &sc->sc_fpregs[31]);
+    __put_user(cpu_alpha_load_fpcr(env), &sc->sc_fpcr);
 
-    err |= __put_user(0, &sc->sc_traparg_a0); /* FIXME */
-    err |= __put_user(0, &sc->sc_traparg_a1); /* FIXME */
-    err |= __put_user(0, &sc->sc_traparg_a2); /* FIXME */
+    __put_user(0, &sc->sc_traparg_a0); /* FIXME */
+    __put_user(0, &sc->sc_traparg_a1); /* FIXME */
+    __put_user(0, &sc->sc_traparg_a2); /* FIXME */
 
     return err;
 }
@@ -5559,10 +5516,10 @@ static void setup_frame(int sig, struct 
target_sigaction *ka,
     if (ka->sa_restorer) {
         r26 = ka->sa_restorer;
     } else {
-        err |= __put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
-        err |= __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn,
-                          &frame->retcode[1]);
-        err |= __put_user(INSN_CALLSYS, &frame->retcode[2]);
+        __put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
+        __put_user(INSN_LDI_R0 + TARGET_NR_sigreturn,
+                   &frame->retcode[1]);
+        __put_user(INSN_CALLSYS, &frame->retcode[2]);
         /* imb() */
         r26 = frame_addr;
     }
@@ -5600,27 +5557,27 @@ static void setup_rt_frame(int sig, struct 
target_sigaction *ka,
 
     err |= copy_siginfo_to_user(&frame->info, info);
 
-    err |= __put_user(0, &frame->uc.tuc_flags);
-    err |= __put_user(0, &frame->uc.tuc_link);
-    err |= __put_user(set->sig[0], &frame->uc.tuc_osf_sigmask);
-    err |= __put_user(target_sigaltstack_used.ss_sp,
-                      &frame->uc.tuc_stack.ss_sp);
-    err |= __put_user(sas_ss_flags(env->ir[IR_SP]),
-                      &frame->uc.tuc_stack.ss_flags);
-    err |= __put_user(target_sigaltstack_used.ss_size,
-                      &frame->uc.tuc_stack.ss_size);
+    __put_user(0, &frame->uc.tuc_flags);
+    __put_user(0, &frame->uc.tuc_link);
+    __put_user(set->sig[0], &frame->uc.tuc_osf_sigmask);
+    __put_user(target_sigaltstack_used.ss_sp,
+               &frame->uc.tuc_stack.ss_sp);
+    __put_user(sas_ss_flags(env->ir[IR_SP]),
+               &frame->uc.tuc_stack.ss_flags);
+    __put_user(target_sigaltstack_used.ss_size,
+               &frame->uc.tuc_stack.ss_size);
     err |= setup_sigcontext(&frame->uc.tuc_mcontext, env, frame_addr, set);
     for (i = 0; i < TARGET_NSIG_WORDS; ++i) {
-        err |= __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
+        __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
     }
 
     if (ka->sa_restorer) {
         r26 = ka->sa_restorer;
     } else {
-        err |= __put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
-        err |= __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn,
-                          &frame->retcode[1]);
-        err |= __put_user(INSN_CALLSYS, &frame->retcode[2]);
+        __put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
+        __put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn,
+                   &frame->retcode[1]);
+        __put_user(INSN_CALLSYS, &frame->retcode[2]);
         /* imb(); */
         r26 = frame_addr;
     }
-- 
2.0.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]