From patchwork Mon Jun 9 12:46:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C83320675 for ; Mon, 9 Jun 2014 12:54:28 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf20819894yha.3 for ; Mon, 09 Jun 2014 05:54:28 -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=VpnYRH5DTC7Ji/9NXhSHvqW1ujeEmfXdlUnjEbEQegc=; b=SHDmXv+V5HuyMf0z7lRuajd689aHsllUPSf5o9Kq0kTtcvhBminb4ZivDliKRjLuWj AtGfDe+3iPTrFIlLrqCSIkS80YG5j9CupbNrNmZBBWIl/us4f52cSYaZMB1bPGf+fiwm qF1jBouTapGc4+WoqOG+Uj401CL5Qc0t8iOMuPbxCKT2t2Iue4g0VdsQ4zSyO9Sa/wFg W5h5yJw3wG3eXWbazaITYPNxTBQA4bA6wPO9LnwwS/rI5423smoT/D8L7U2PaV7tCBfq 32EfuJyOBnRABHnDtSTMsOzM7BepJEYRnksFYmD1BoFAfUoOnSq/5jBjCm3xUZNImENk 0Fpg== X-Gm-Message-State: ALoCoQm7ecuU3couvxdn4QoLhuArgQXf19oUMnB5qogDocrppMpJTz6aanzmYdHsd+lJeh2DiSzm X-Received: by 10.58.160.72 with SMTP id xi8mr13539657veb.15.1402318468140; Mon, 09 Jun 2014 05:54:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.145 with SMTP id g17ls1468983qge.76.gmail; Mon, 09 Jun 2014 05:54:28 -0700 (PDT) X-Received: by 10.53.8.162 with SMTP id dl2mr21354190vdd.24.1402318467983; Mon, 09 Jun 2014 05:54:27 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id be5si11798127vdb.107.2014.06.09.05.54.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db11so1023057veb.12 for ; Mon, 09 Jun 2014 05:54:27 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr5624087vec.9.1402318467803; Mon, 09 Jun 2014 05:54:27 -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 vs6csp143688vcb; Mon, 9 Jun 2014 05:54:27 -0700 (PDT) X-Received: by 10.224.171.195 with SMTP id i3mr32339168qaz.44.1402318467318; Mon, 09 Jun 2014 05:54:27 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s95si22922229qge.69.2014.06.09.05.54.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:54:27 -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]:60907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtz5m-0008Pf-UQ for patch@linaro.org; Mon, 09 Jun 2014 08:54:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyX-0005ci-UL for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtyyM-0007gt-Qv for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:57 -0400 Received: from afflict.kos.to ([92.243.29.197]:40145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyM-0007g1-Ei 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 8BCEC26543; 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:29 +0300 Message-Id: <108a10196a33d52fc29a42f0e6b5689572dad3d7.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: 92.243.29.197 Cc: peter.maydell@linaro.org, Riku Voipio Subject: [Qemu-devel] [PULL 04/18] 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.181 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 0bf6213..421bd48 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])) @@ -5457,10 +5436,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); @@ -5481,8 +5460,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, @@ -5531,7 +5508,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; @@ -5586,7 +5563,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]); }