From patchwork Wed Apr 23 13:11:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 28890 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82CD820534 for ; Wed, 23 Apr 2014 13:18:43 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf3660909veb.3 for ; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=f8u9bfVRqSOyBX4ZY2zx+Zcui+sVjXK45WijsgGEPkA=; b=VkicQ1iiahklEgnPzAtydfeLsd6n9iJ69PLqcOaLra9ysm/zjr8Pl6+mT/OQRpOvFT kE1ZcpJUlOFp16rJgDBQbPNIY3pUWW7VncOh9ntl8WwB6vjEELVnGLoBr14kDE67QYKJ rJbCoHscBPXACRuN0DTYyFt/BsVWniJXubjTNfaSg7JaJWKnmYFicCYg9H3jTf5WRB4v ZzETjUwGI25p3I961Vr649ri4eqjuc2fCzwgnf8kMGtvAMIVElJQUfelURQ1JJi4eMfV 2MNonPVt6lYL070ZbSvDBVsfxcmyjtF4DOmM1CjEijWKCN8XI6FIB9zxJC42SRmeNI1j 4LZA== X-Gm-Message-State: ALoCoQncezP3QH6/+Udchli9iGife2Li2B7+IOYZhigv3Ggaje0l0oRZvm35t8SuX5v+3CIXerkR X-Received: by 10.58.248.99 with SMTP id yl3mr28260065vec.9.1398259123298; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.149 with SMTP id l21ls333893qgd.81.gmail; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) X-Received: by 10.58.54.12 with SMTP id f12mr154576vep.75.1398259123175; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id sh5si162701vdc.50.2014.04.23.06.18.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:18:43 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jx11so1115212veb.3 for ; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr43798vec.80.1398259123085; Wed, 23 Apr 2014 06:18:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp103374vcb; Wed, 23 Apr 2014 06:18:42 -0700 (PDT) X-Received: by 10.140.86.178 with SMTP id p47mr12145562qgd.66.1398259122659; Wed, 23 Apr 2014 06:18:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b39si440405qge.56.2014.04.23.06.18.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Apr 2014 06:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wcx4U-0007AX-31 for patch@linaro.org; Wed, 23 Apr 2014 09:18:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcwyF-0001ks-DU for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wcwy8-0001JY-Kr for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:15 -0400 Received: from afflict.kos.to ([92.243.29.197]:42801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wcwy8-0001Id-9f for qemu-devel@nongnu.org; Wed, 23 Apr 2014 09:12:08 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id E3700264D3 for ; Wed, 23 Apr 2014 15:12:05 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 23 Apr 2014 16:11:56 +0300 Message-Id: <3165c9a99d5466f88eb7ffa53165d48d54dccca8.1398257165.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Subject: [Qemu-devel] [PATCH 05/13] signal.c: remove return value from restore_sigcontext X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Riku Voipio make most implementations of restore_sigcontext void and remove checking it's return value from functions calling restore_sigcontext. The exception is the X86 version of the function that is too different from others to deal in this way. Signed-off-by: Riku Voipio --- linux-user/signal.c | 65 +++++++++++++---------------------------------------- 1 file changed, 16 insertions(+), 49 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 6427e6e..8d2b6c9 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1547,12 +1547,6 @@ static const abi_ulong retcodes[4] = { SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN }; - -static inline int valid_user_regs(CPUARMState *regs) -{ - return 1; -} - static void setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/ CPUARMState *env, abi_ulong mask) @@ -1843,10 +1837,9 @@ static void setup_rt_frame(int usig, struct target_sigaction *ka, } } -static int +static void restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) { - int err = 0; uint32_t cpsr; __get_user(env->regs[0], &sc->arm_r0); @@ -1869,10 +1862,6 @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) __get_user(cpsr, &sc->arm_cpsr); cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC); #endif - - err |= !valid_user_regs(env); - - return err; } static long do_sigreturn_v1(CPUARMState *env) @@ -1906,8 +1895,7 @@ static long do_sigreturn_v1(CPUARMState *env) target_to_host_sigset_internal(&host_set, &set); do_sigprocmask(SIG_SETMASK, &host_set, NULL); - if (restore_sigcontext(env, &frame->sc)) - goto badframe; + restore_sigcontext(env, &frame->sc); #if 0 /* Send SIGTRAP if we're single-stepping */ @@ -1987,8 +1975,7 @@ static int do_sigframe_return_v2(CPUARMState *env, target_ulong frame_addr, target_to_host_sigset(&host_set, &uc->tuc_sigmask); do_sigprocmask(SIG_SETMASK, &host_set, NULL); - if (restore_sigcontext(env, &uc->tuc_mcontext)) - return 1; + restore_sigcontext(env, &uc->tuc_mcontext); /* Restore coprocessor signal frame */ regspace = uc->tuc_regspace; @@ -2078,8 +2065,7 @@ static long do_rt_sigreturn_v1(CPUARMState *env) target_to_host_sigset(&host_set, &frame->uc.tuc_sigmask); do_sigprocmask(SIG_SETMASK, &host_set, NULL); - if (restore_sigcontext(env, &frame->uc.tuc_mcontext)) - goto badframe; + restore_sigcontext(env, &frame->uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe_v1, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) goto badframe; @@ -2890,10 +2876,9 @@ static inline void setup_sigcontext(CPUMIPSState *regs, } } -static inline int +static inline void restore_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc) { - int err = 0; int i; __get_user(regs->CP0_EPC, &sc->sc_pc); @@ -2920,8 +2905,6 @@ restore_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc) for (i = 0; i < 32; ++i) { __get_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]); } - - return err; } /* @@ -3032,8 +3015,7 @@ long do_sigreturn(CPUMIPSState *regs) target_to_host_sigset_internal(&blocked, &target_set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); - if (restore_sigcontext(regs, &frame->sf_sc)) - goto badframe; + restore_sigcontext(regs, &frame->sf_sc); #if 0 /* @@ -3136,8 +3118,7 @@ long do_rt_sigreturn(CPUMIPSState *env) target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask); do_sigprocmask(SIG_SETMASK, &blocked, NULL); - if (restore_sigcontext(env, &frame->rs_uc.tuc_mcontext)) - goto badframe; + restore_sigcontext(env, &frame->rs_uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, rs_uc.tuc_stack), @@ -3250,10 +3231,9 @@ static void setup_sigcontext(struct target_sigcontext *sc, __put_user(mask, &sc->oldmask); } -static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, +static void restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, target_ulong *r0_p) { - unsigned int err = 0; int i; #define COPY(x) __get_user(regs->x, &sc->sc_##x) @@ -3278,7 +3258,6 @@ static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, regs->tra = -1; /* disable syscall checks */ __get_user(*r0_p, &sc->sc_gregs[0]); - return err; } static void setup_frame(int sig, struct target_sigaction *ka, @@ -3423,8 +3402,7 @@ long do_sigreturn(CPUSH4State *regs) target_to_host_sigset_internal(&blocked, &target_set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); - if (restore_sigcontext(regs, &frame->sc, &r0)) - goto badframe; + restore_sigcontext(regs, &frame->sc, &r0); unlock_user_struct(frame, frame_addr, 0); return r0; @@ -3452,8 +3430,7 @@ long do_rt_sigreturn(CPUSH4State *regs) target_to_host_sigset(&blocked, &frame->uc.tuc_sigmask); do_sigprocmask(SIG_SETMASK, &blocked, NULL); - if (restore_sigcontext(regs, &frame->uc.tuc_mcontext, &r0)) - goto badframe; + restore_sigcontext(regs, &frame->uc.tuc_mcontext, &r0); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), @@ -5087,10 +5064,9 @@ static void setup_sigcontext(struct target_sigcontext *sc, CPUM68KState *env, __put_user(env->pc, &sc->sc_pc); } -static int +static void restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0) { - int err = 0; int temp; __get_user(env->aregs[7], &sc->sc_usp); @@ -5102,8 +5078,6 @@ restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0) env->sr = (env->sr & 0xff00) | (temp & 0xff); *pd0 = tswapl(sc->sc_d0); - - return err; } /* @@ -5344,8 +5318,7 @@ long do_sigreturn(CPUM68KState *env) /* restore registers */ - if (restore_sigcontext(env, &frame->sc, &d0)) - goto badframe; + restore_sigcontext(env, &frame->sc, &d0); unlock_user_struct(frame, frame_addr, 0); return d0; @@ -5463,11 +5436,11 @@ static void setup_sigcontext(struct target_sigcontext *sc, CPUAlphaState *env, __put_user(0, &sc->sc_traparg_a2); /* FIXME */ } -static int restore_sigcontext(CPUAlphaState *env, +static void restore_sigcontext(CPUAlphaState *env, struct target_sigcontext *sc) { uint64_t fpcr; - int i, err = 0; + int i; __get_user(env->pc, &sc->sc_pc); @@ -5480,8 +5453,6 @@ static int restore_sigcontext(CPUAlphaState *env, __get_user(fpcr, &sc->sc_fpcr); cpu_alpha_store_fpcr(env, fpcr); - - return err; } static inline abi_ulong get_sigframe(struct target_sigaction *sa, @@ -5615,9 +5586,7 @@ long do_sigreturn(CPUAlphaState *env) target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); - if (restore_sigcontext(env, sc)) { - goto badframe; - } + restore_sigcontext(env, sc); unlock_user_struct(sc, sc_addr, 0); return env->ir[IR_V0]; @@ -5638,9 +5607,7 @@ long do_rt_sigreturn(CPUAlphaState *env) target_to_host_sigset(&set, &frame->uc.tuc_sigmask); do_sigprocmask(SIG_SETMASK, &set, NULL); - if (restore_sigcontext(env, &frame->uc.tuc_mcontext)) { - goto badframe; - } + restore_sigcontext(env, &frame->uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, env->ir[IR_SP]) == -EFAULT) {