From patchwork Mon Jun 9 12:46:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31554 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7527320675 for ; Mon, 9 Jun 2014 12:52:20 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf1891338qcx.5 for ; Mon, 09 Jun 2014 05:52:20 -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:cc: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=P8WPzmuRpwMsKH7w+3HoFfXXe5FdMDb0C/lrRDMpqqc=; b=iQBiToY6Ol1O+/F8kinag5Ip0vUDpOtbnYSKKHCP+7415SzL+5kT7zkPMm+Iciayns BnEw7wwskx1neEmJAjIYSjhv75w/sJbMg7L+8dYiFRO1ie6I2rbmF5GwIPqRKPi995ro +ebMDeGbpRXeOC2LawAiPUjbuK11prQUAFrrR369R05g4OwVuG1eNoibX6yXgtytxCNj q15RGkOg33EKIO1qDSu7PBYTDWnCQJ2xVnosXM6MUJxE2wwqBZ9p7Qd1TYfhlKiwq+eF vJpn6QNvoYkUSi6X3rbxSpwprIxYAB2GIYy5Scjx9MU6roezBYZ/TyWKxEwJ337TTOCW cB3A== X-Gm-Message-State: ALoCoQnFYMMX8tnG8YzTnD9nWo6GaUk5a+mgktoDDwaXS6WzQtDpZbi1ll7k40JZemsnDes72D7v X-Received: by 10.236.110.68 with SMTP id t44mr5603478yhg.31.1402318340332; Mon, 09 Jun 2014 05:52:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.133 with SMTP id t5ls1590702qgt.43.gmail; Mon, 09 Jun 2014 05:52:20 -0700 (PDT) X-Received: by 10.52.29.236 with SMTP id n12mr21520466vdh.38.1402318340159; Mon, 09 Jun 2014 05:52:20 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id q13si10573537vci.29.2014.06.09.05.52.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jw12so3527225veb.11 for ; Mon, 09 Jun 2014 05:52:20 -0700 (PDT) X-Received: by 10.220.53.72 with SMTP id l8mr25829517vcg.16.1402318340063; Mon, 09 Jun 2014 05:52:20 -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.221.54.6 with SMTP id vs6csp143547vcb; Mon, 9 Jun 2014 05:52:19 -0700 (PDT) X-Received: by 10.224.21.1 with SMTP id h1mr3098900qab.103.1402318339630; Mon, 09 Jun 2014 05:52:19 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c11si22894681qgc.99.2014.06.09.05.52.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:52:19 -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]:60884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtz3j-0004fn-9m for patch@linaro.org; Mon, 09 Jun 2014 08:52:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyU-0005ca-RG for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtyyN-0007hJ-0e for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:54 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=55289 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyM-0007gQ-Lf for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:46 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 9914226544; Mon, 9 Jun 2014 14:46:44 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 9 Jun 2014 15:46:30 +0300 Message-Id: <1e20417cc09e0a4d0184c4a26e4e6b9d5374a602.1402317549.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: peter.maydell@linaro.org, Riku Voipio Subject: [Qemu-devel] [PULL 05/18] signal/all: 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) 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, and arm version, to keep possibility of erroring out from failed valid_user_regs. v3: keep arm valid_user_regs for filling in near future. Signed-off-by: Riku Voipio Reviewed-by: Peter Maydell --- linux-user/signal.c | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 421bd48..b2bc729 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2889,10 +2889,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); @@ -2919,8 +2918,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; } /* @@ -3031,8 +3028,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 /* @@ -3135,8 +3131,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), @@ -3249,10 +3244,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) @@ -3277,7 +3271,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, @@ -3422,8 +3415,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; @@ -3451,8 +3443,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), @@ -5086,10 +5077,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); @@ -5101,8 +5091,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; } /* @@ -5343,8 +5331,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; @@ -5462,11 +5449,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); @@ -5479,8 +5466,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, @@ -5614,9 +5599,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]; @@ -5637,9 +5620,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) {