From patchwork Tue Jun 17 14:56:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 32036 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 53EA6206A0 for ; Tue, 17 Jun 2014 15:00:03 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rd18sf42385139iec.10 for ; Tue, 17 Jun 2014 08:00:02 -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: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=iOmyr5ROvAzbyuRTHHH6z4Mvn3cYf9jJPcn6QnNVdlI=; b=dI4sfWVtVQ4R/Sq8KD8MUBwQS1a1s5TSVucQmM085vgxzYrAwrVNE1aX2y+lgMxsVh aGY2P0XwpjBEGXj7qqMgAW/FMEGaitY4uId//lQOcQSZmRX/brtCyzfFGVhBuHrdcJkL i/EinYNq65RBXgd5/ProSWGkYlg/qSp1NELfTeZMecBELwwlTKB/6EuogKfm4vLUnpcL 1tQQ5sEZfKqAJOgf+te7UPYAd6PlUio6wYffDnE6HUHy/02nWHoePcGEWCnfN6JPGZPT ZSKXPRlZHDu5GSZ7HNO9ADMWXyHPOFxFmCP5AM45Kz4hJ92DcABCzrHLquRsYdz15C6Z S20g== X-Gm-Message-State: ALoCoQlvMtZopVIaXhm44wQGJDlBdHnvBwSLYK5VeduVNa/9ogT3Xk2jB3u/L0BpyfqE9aoBRts4 X-Received: by 10.42.19.73 with SMTP id a9mr729763icb.31.1403017202670; Tue, 17 Jun 2014 08:00:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.103 with SMTP id 94ls4977411qgw.13.gmail; Tue, 17 Jun 2014 08:00:02 -0700 (PDT) X-Received: by 10.58.195.172 with SMTP id if12mr22268311vec.12.1403017202448; Tue, 17 Jun 2014 08:00:02 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id lv1si5566263vcb.85.2014.06.17.08.00.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 08:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jx11so4923460veb.19 for ; Tue, 17 Jun 2014 08:00:02 -0700 (PDT) X-Received: by 10.52.52.168 with SMTP id u8mr18573634vdo.25.1403017202369; Tue, 17 Jun 2014 08:00:02 -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 vs6csp215783vcb; Tue, 17 Jun 2014 08:00:01 -0700 (PDT) X-Received: by 10.224.47.2 with SMTP id l2mr21443825qaf.85.1403017201818; Tue, 17 Jun 2014 08:00:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t2si17220094qae.64.2014.06.17.08.00.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Jun 2014 08:00:01 -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]:51151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwurh-00017f-G5 for patch@linaro.org; Tue, 17 Jun 2014 11:00:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuox-0005hQ-Nx for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wwuor-0004Oy-6Y for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:11 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=33141 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwuoq-0004OK-TP for qemu-devel@nongnu.org; Tue, 17 Jun 2014 10:57:05 -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 3D97226543; Tue, 17 Jun 2014 16:57:03 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 17 Jun 2014 17:56:47 +0300 Message-Id: <41ecc72ba5932381208e151bf2d2149a0342beff.1403016610.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: 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 v2 04/17] signal/all: remove return value from setup_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.174 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 all implementations of setup_sigcontext void and remove checking it's return value from functions calling setup_sigcontext. Signed-off-by: Riku Voipio Reviewed-by: Peter Maydell --- linux-user/signal.c | 65 +++++++++++++++++------------------------------------ 1 file changed, 21 insertions(+), 44 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 74c54bf..b59ec3d 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -836,12 +836,11 @@ struct rt_sigframe */ /* XXX: save x87 state */ -static int -setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, - CPUX86State *env, abi_ulong mask, abi_ulong fpstate_addr) +static void setup_sigcontext(struct target_sigcontext *sc, + struct target_fpstate *fpstate, CPUX86State *env, abi_ulong mask, + abi_ulong fpstate_addr) { CPUState *cs = CPU(x86_env_get_cpu(env)); - int err = 0; uint16_t magic; /* already locked in setup_frame() */ @@ -874,7 +873,6 @@ setup_sigcontext(struct target_sigcontext *sc, struct target_fpstate *fpstate, /* non-iBCS2 extensions.. */ __put_user(mask, &sc->oldmask); __put_user(env->cr[2], &sc->cr2); - return err; } /* @@ -994,9 +992,9 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, &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)); + 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; @@ -2855,10 +2853,9 @@ static inline int install_sigtramp(unsigned int *tramp, unsigned int syscall) return err; } -static inline int -setup_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc) +static inline void setup_sigcontext(CPUMIPSState *regs, + struct target_sigcontext *sc) { - int err = 0; int i; __put_user(exception_resume_pc(regs), &sc->sc_pc); @@ -2890,8 +2887,6 @@ setup_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc) for (i = 0; i < 32; ++i) { __put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]); } - - return err; } static inline int @@ -2978,8 +2973,7 @@ static void setup_frame(int sig, struct target_sigaction * ka, install_sigtramp(frame->sf_code, TARGET_NR_sigreturn); - if(setup_sigcontext(regs, &frame->sf_sc)) - goto give_sigsegv; + setup_sigcontext(regs, &frame->sf_sc); for(i = 0; i < TARGET_NSIG_WORDS; i++) { if(__put_user(set->sig[i], &frame->sf_mask.sig[i])) @@ -3226,10 +3220,9 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, return (sp - frame_size) & -8ul; } -static int setup_sigcontext(struct target_sigcontext *sc, +static void setup_sigcontext(struct target_sigcontext *sc, CPUSH4State *regs, unsigned long mask) { - int err = 0; int i; #define COPY(x) __put_user(regs->x, &sc->sc_##x) @@ -3254,8 +3247,6 @@ static int setup_sigcontext(struct target_sigcontext *sc, /* non-iBCS2 extensions.. */ __put_user(mask, &sc->oldmask); - - return err; } static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, @@ -3304,7 +3295,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, signal = current_exec_domain_sig(sig); - err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); + setup_sigcontext(&frame->sc, regs, set->sig[0]); for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) { __put_user(set->sig[i + 1], &frame->extramask[i]); @@ -3954,11 +3945,10 @@ badframe: /* Set up a signal frame. */ -static int setup_sigcontext(struct target_sigcontext *sc, +static void setup_sigcontext(struct target_sigcontext *sc, CPUOpenRISCState *regs, unsigned long mask) { - int err = 0; unsigned long usp = regs->gpr[1]; /* copy the regs. they are first in sc so we can use sc directly */ @@ -3972,7 +3962,7 @@ static int setup_sigcontext(struct target_sigcontext *sc, /* then some other stuff */ __put_user(mask, &sc->oldmask); - __put_user(usp, &sc->usp); return err; + __put_user(usp, &sc->usp); } static inline unsigned long align_sigframe(unsigned long sp) @@ -4047,14 +4037,10 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, __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]); + setup_sigcontext(&frame->sc, env, set->sig[0]); /*err |= copy_to_user(frame->uc.tuc_sigmask, set, sizeof(*set));*/ - if (err) { - goto give_sigsegv; - } - /* 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 */ @@ -5087,12 +5073,9 @@ struct target_rt_sigframe struct target_ucontext uc; }; -static int -setup_sigcontext(struct target_sigcontext *sc, CPUM68KState *env, - abi_ulong mask) +static void setup_sigcontext(struct target_sigcontext *sc, CPUM68KState *env, + abi_ulong mask) { - int err = 0; - __put_user(mask, &sc->sc_mask); __put_user(env->aregs[7], &sc->sc_usp); __put_user(env->dregs[0], &sc->sc_d0); @@ -5101,8 +5084,6 @@ setup_sigcontext(struct target_sigcontext *sc, CPUM68KState *env, __put_user(env->aregs[1], &sc->sc_a1); __put_user(env->sr, &sc->sc_sr); __put_user(env->pc, &sc->sc_pc); - - return err; } static int @@ -5162,9 +5143,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, sc_addr = frame_addr + offsetof(struct target_sigframe, sc); __put_user(sc_addr, &frame->psc); - err |= setup_sigcontext(&frame->sc, env, set->sig[0]); - if (err) - goto give_sigsegv; + setup_sigcontext(&frame->sc, env, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) @@ -5456,10 +5435,10 @@ struct target_rt_sigframe { #define INSN_LDI_R0 0x201f0000 #define INSN_CALLSYS 0x00000083 -static int setup_sigcontext(struct target_sigcontext *sc, CPUAlphaState *env, +static void setup_sigcontext(struct target_sigcontext *sc, CPUAlphaState *env, abi_ulong frame_addr, target_sigset_t *set) { - int i, err = 0; + int i; __put_user(on_sig_stack(frame_addr), &sc->sc_onstack); __put_user(set->sig[0], &sc->sc_mask); @@ -5480,8 +5459,6 @@ static int setup_sigcontext(struct target_sigcontext *sc, CPUAlphaState *env, __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; } static int restore_sigcontext(CPUAlphaState *env, @@ -5530,7 +5507,7 @@ static void setup_frame(int sig, struct target_sigaction *ka, goto give_sigsegv; } - err |= setup_sigcontext(&frame->sc, env, frame_addr, set); + setup_sigcontext(&frame->sc, env, frame_addr, set); if (ka->sa_restorer) { r26 = ka->sa_restorer; @@ -5585,7 +5562,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, &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); + setup_sigcontext(&frame->uc.tuc_mcontext, env, frame_addr, set); for (i = 0; i < TARGET_NSIG_WORDS; ++i) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); }