From patchwork Tue Jan 27 21:07:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 43861 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ECEBF23FFF for ; Tue, 27 Jan 2015 22:03:10 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d49sf9054555eek.2 for ; Tue, 27 Jan 2015 14:03:10 -0800 (PST) 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=t4c+nLAMgFyVcVi4ymcsAjEzTsgh1x61wazyT9l53NI=; b=Z4QhRGJLzOuzW4sQgJSTQePc9YEByXm3hxL3T+c1FuJKsjqKZ+h7U9DHqGOiHGhPVD Xw+JKqP5KX6HMhLO0/6F38QoemCSJZ3blk199yfqgE4f9jM+Vb9MkaSB9gysza6Az6gK qM01qOwZeCD9taBsdRiTqObUsJ7zATAv7e3KCCVjRhnDYFDpRFdwFliCf/4t1BtSBYY1 pZ+oHOJFW1URBIfzxUByn0b7cctjIOgaq88w0IACSO3X7hnm/naBhYM6VbrFY2XTqQua tkD5UWbAORlY82TTBeG5e574psOt6pVNYXVmpggHV2KQ5UnfeQQbd1AlOE7QWdjgK/4M vWvA== X-Gm-Message-State: ALoCoQkvqvmU4t60/H/+C+nvUsdgl17q2qTRYohjGp1accTSNqN+Rj59wAiE6GlvPa0tdCmaXuBB X-Received: by 10.112.35.135 with SMTP id h7mr562238lbj.23.1422396190137; Tue, 27 Jan 2015 14:03:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.35 with SMTP id lh3ls96245lab.12.gmail; Tue, 27 Jan 2015 14:03:10 -0800 (PST) X-Received: by 10.152.206.41 with SMTP id ll9mr4414229lac.62.1422396189929; Tue, 27 Jan 2015 14:03:09 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id u8si2479629lag.83.2015.01.27.14.03.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 14:03:09 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id s18so15858709lam.3 for ; Tue, 27 Jan 2015 14:03:09 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr4266151lbc.23.1422396189800; Tue, 27 Jan 2015 14:03:09 -0800 (PST) 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.112.35.133 with SMTP id h5csp1237747lbj; Tue, 27 Jan 2015 14:03:09 -0800 (PST) X-Received: by 10.224.25.9 with SMTP id x9mr6554082qab.78.1422396188447; Tue, 27 Jan 2015 14:03:08 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p20si3244553qgd.117.2015.01.27.14.03.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 14:03:08 -0800 (PST) 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]:49955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDN2-0004tZ-41 for patch@linaro.org; Tue, 27 Jan 2015 16:08:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDMA-00047Z-Ll for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGDM5-0005mv-KR for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:30 -0500 Received: from afflict.kos.to ([92.243.29.197]:35446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGDM5-0005mH-Ap for qemu-devel@nongnu.org; Tue, 27 Jan 2015 16:07:25 -0500 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 3472E264D9; Tue, 27 Jan 2015 22:07:23 +0100 (CET) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 27 Jan 2015 23:07:17 +0200 Message-Id: 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 Subject: [Qemu-devel] [PULL 06/11] linux-user/signal.c: Remove unnecessary wrapper copy_siginfo_to_user 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.215.44 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: Peter Maydell The function copy_siginfo_to_user() just calls tswap_siginfo(), so call the latter function directly and delete the wrapper function. The wrapper is actually misleading since it implies that the semantics are like the kernel function with the same name which copies the data to a guest user-space address. In fact tswap_siginfo() just does data-structure conversion between two structures whose addresses are host addresses (the copy to userspace is handled in QEMU by the lock_user/unlock_user calls). This also fixes clang complaints about the wrapper being unused in some configs. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/signal.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index fa955ef..8065710 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -732,12 +732,6 @@ int do_sigaction(int sig, const struct target_sigaction *act, return ret; } -static inline void copy_siginfo_to_user(target_siginfo_t *tinfo, - const target_siginfo_t *info) -{ - tswap_siginfo(tinfo, info); -} - #if defined(TARGET_I386) && TARGET_ABI_BITS == 32 /* from the Linux kernel */ @@ -986,7 +980,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(addr, &frame->pinfo); addr = frame_addr + offsetof(struct rt_sigframe, uc); __put_user(addr, &frame->puc); - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); @@ -1353,7 +1347,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, env->pc = ka->_sa_handler; env->xregs[30] = return_addr; if (info) { - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info); env->xregs[2] = frame_addr + offsetof(struct target_rt_sigframe, uc); } @@ -1770,7 +1764,7 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); __put_user(uc_addr, &frame->puc); - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); /* Clear all the bits of the ucontext we don't use. */ memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); @@ -1808,7 +1802,7 @@ static void setup_rt_frame_v2(int usig, struct target_sigaction *ka, info_addr = frame_addr + offsetof(struct rt_sigframe_v2, info); uc_addr = frame_addr + offsetof(struct rt_sigframe_v2, uc); - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); setup_sigframe_v2(&frame->uc, set, env); @@ -3010,7 +3004,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, install_sigtramp(frame->rs_code, TARGET_NR_rt_sigreturn); - copy_siginfo_to_user(&frame->rs_info, info); + tswap_siginfo(&frame->rs_info, info); __put_user(0, &frame->rs_uc.tuc_flags); __put_user(0, &frame->rs_uc.tuc_link); @@ -3275,7 +3269,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); @@ -3934,7 +3928,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(uc_addr, &frame->puc); if (ka->sa_flags & SA_SIGINFO) { - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); } /*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/ @@ -4182,7 +4176,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, } qemu_log("%s: 1\n", __FUNCTION__); - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); @@ -4757,7 +4751,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1)) goto sigsegv; - copy_siginfo_to_user(&rt_sf->info, info); + tswap_siginfo(&rt_sf->info, info); __put_user(0, &rt_sf->uc.tuc_flags); __put_user(0, &rt_sf->uc.tuc_link); @@ -5177,7 +5171,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); /* Create the ucontext */ @@ -5454,7 +5448,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, goto give_sigsegv; } - copy_siginfo_to_user(&frame->info, info); + tswap_siginfo(&frame->info, info); __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link);