From patchwork Wed Jun 8 13:30:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A71BF604DB for ; Wed, 8 Jun 2016 14:07:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 974FC25D91 for ; Wed, 8 Jun 2016 14:07:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BEC328047; Wed, 8 Jun 2016 14:07:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36EC925D91 for ; Wed, 8 Jun 2016 14:07:01 +0000 (UTC) Received: from localhost ([::1]:57212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAe8L-0004DJ-3J for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 10:07:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZV-0004OG-D3 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZT-0005oA-Cx for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:00 -0400 Received: from mail-lf0-x229.google.com ([2a00:1450:4010:c07::229]:36271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZS-0005nu-IO for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:59 -0400 Received: by mail-lf0-x229.google.com with SMTP id j5so5840539lfb.3 for ; Wed, 08 Jun 2016 06:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GaISs98mfVIjdLclH/huv88G9IzCe8d+JrdmOtCBatg=; b=eFeLKCu+2rjwplt0E7lpeQ56pAze+pBu9G28ANTj3mAQnODGq7wrTj+ee9TDMZctLE vDVHKnMIgqo0+Yz7tRthzMOh7wITKQQCOh+7qOKHfO9zLgUZyIkZhAl3fnvnuIAsavrs m979Fl+afzR5zRTgNldD68hevk+B+j71x5PF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GaISs98mfVIjdLclH/huv88G9IzCe8d+JrdmOtCBatg=; b=EPS5YtYX840l/FSco94Fe//YC4/UNcv19w+i1D+S3AF0yiODdNIenID0hg+myGhpFo AHqtONNKENOTIpzDzCjih5zWW67WGde2SE9zWMUUP/rgyjlrWNWC5S3KylXcyD1RnBZp Do+WUYYdBP37YHx9CkL/HQQ04IOis/WsMH8fvM2LixT1rvrpvXKko2if7bsZAsRiCtvl o0KmXZSNJG5NDhlzfpRUI6VOeIfXJRS4rMyOxOq/l2oVobE/RHQ9QWJ64Kq9Lb9i+D+U dNzdEk0lzlFAuEiuj9XeYe4ep2sxMHcBfteIwFtZVYgaKU914wN4E0c0UbY5s1ldA6En npxA== X-Gm-Message-State: ALyK8tLmyE5oubyqV5hr6EdELkQ9aHHQ3Tc3sxumnZ9CG/pgxW2ihBsKCdm4rm0j4zDSpq2B X-Received: by 10.46.1.42 with SMTP id 42mr1390234ljb.27.1465392657816; Wed, 08 Jun 2016 06:30:57 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.30.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:56 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:06 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::229 Subject: [Qemu-devel] [PULL 25/44] linux-user: Fix handling of arm_fadvise64_64 syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Maydell 32-bit ARM has an odd variant of the fadvise syscall which has rearranged arguments, which we try to implement. Unfortunately we got the rearrangement wrong. This is a six-argument syscall whose arguments are: * fd * advise parameter * offset high half * offset low half * len high half * len low half Stop trying to share code with the standard fadvise syscalls, and just implement the syscall with the correct argument order. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a2d591e..8c08e7c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9970,18 +9970,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #endif #ifdef TARGET_NR_arm_fadvise64_64 case TARGET_NR_arm_fadvise64_64: - { - /* - * arm_fadvise64_64 looks like fadvise64_64 but - * with different argument order - */ - abi_long temp; - temp = arg3; - arg3 = arg4; - arg4 = temp; - } + /* arm_fadvise64_64 looks like fadvise64_64 but + * with different argument order: fd, advice, offset, len + * rather than the usual fd, offset, len, advice. + * Note that offset and len are both 64-bit so appear as + * pairs of 32-bit registers. + */ + ret = posix_fadvise(arg1, target_offset64(arg3, arg4), + target_offset64(arg5, arg6), arg2); + ret = -host_to_target_errno(ret); + break; #endif -#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_arm_fadvise64_64) || defined(TARGET_NR_fadvise64) +#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_fadvise64) #ifdef TARGET_NR_fadvise64_64 case TARGET_NR_fadvise64_64: #endif