From patchwork Mon Oct 17 13:24:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9379313 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 7FC71600CA for ; Mon, 17 Oct 2016 13:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71707290E8 for ; Mon, 17 Oct 2016 13:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 660EB290EB; Mon, 17 Oct 2016 13:51:32 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 DFAD0290E8 for ; Mon, 17 Oct 2016 13:51:28 +0000 (UTC) Received: from localhost ([::1]:33189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8K8-00084m-3p for patchwork-qemu-devel@patchwork.kernel.org; Mon, 17 Oct 2016 09:51:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7ug-0003Og-HP for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw7uf-0003MI-Kj for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:10 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:34585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bw7uf-0003LH-CK for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:09 -0400 Received: by mail-lf0-x22b.google.com with SMTP id b81so285344398lfe.1 for ; Mon, 17 Oct 2016 06:25:09 -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=nL3fsZmx/6RLrXvtotQJDt50ExW8VCcXDIjnF+GTmUc=; b=M5kmKLuE4drkm9UTzPQyXdjdAApq9i1+zvrlB7tcD+4LKSzWCfpMXh8Yl2zAIEglWO qelSbynNJPaJSTiVSibS6zq2ioCSFcnLVzLfXtttX9w14WZLHhkO56Qb8ZomKEsRpejA 4nLxlr5Ii4+Ud6l7MkhMK0ReuLBi7axYXbL+A= 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=nL3fsZmx/6RLrXvtotQJDt50ExW8VCcXDIjnF+GTmUc=; b=j6BAlUQpwxYCWM16aSlB7qQ/WiD9RxtT/48AVBhTkaY5ZuJD0ETHXX/hJcmonCiLXZ A6MH2Kejddi8bltUjpnNVXf8mnTKjQvGxUR12dPWNCKuVqqDHtkBKGzAIbu/DxxW86Jc Aogms56wNLDMvZWN+i6+qYA+P9JL+1+eU1cErCH2WMRanUva669WcLWQhxfSmzEnsxtO b3xTFRVr5fZapa2USHX4Xn6T+uiHGzlxnO/Ovn+VK8cd/gdyW7k4H7QTzpjqMKugEr4B RMO3y2rl1vqMLgBVoC72aPVbClMJE/6TBSqbeWv1M85M1QQGYRcuGw4VO/z5NHk+3OpJ i0nQ== X-Gm-Message-State: AA6/9Rmikb2Dg5VxMz6nJ87UiLfnTuu7faF16kk9pXsXa+vYMlAAQ9YxcCcKRzi/ZjG8mlNV X-Received: by 10.25.155.77 with SMTP id d74mr12466807lfe.120.1476710707454; Mon, 17 Oct 2016 06:25:07 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id y81sm7782857lff.29.2016.10.17.06.25.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 06:25:06 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 16:24:37 +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::22b Subject: [Qemu-devel] [PULL 19/22] linux-user: Fix fadvise64() syscall support for Mips32 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 , Aleksandar Markovic Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Aleksandar Markovic By looking at the file arch/mips/kernel/scall32-o32.S in Linux kernel, it can be deduced that, for Mips32 platform, syscall corresponding to number _NR_fadvise64 as defined in kernel file arch/mips/include/uapi/asm/unistd.h translates to kernel function sys_fadvise64_64, and that argument layout for this system call is as follows: 0 32 0 32 +----------------+----------------+ (arg1) | fd | __pad | (arg2) +----------------+----------------+ (arg3) | buffer | (arg4) +----------------+----------------+ (arg5) | len | (arg6) +----------------+----------------+ (arg7) | advise | not used | (arg8) +----------------+----------------+ The same argument layout can be deduced from glibc code, and relevant commit messages in linux kernel and glibc. The fix is to change TARGET_NR_fadvise64 to TARGET_NR_fadvise64_64 in Mips32 syscall numbers table. Array mips_syscall_args[] in linux-user/main.c also already have "fadvise64_64" (and not "fadvise64") in corresponding place for the syscall number in question, so no change for linux-user/main.c. This patch also fixes the failure LTP test posix_fadvise03, if executed on Qemu-emulated Mips32 platform (user mode). Signed-off-by: Aleksandar Rikalo Signed-off-by: Miroslav Tisma Signed-off-by: Aleksandar Markovic Signed-off-by: Riku Voipio --- linux-user/mips/syscall_nr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h index 6819f86..ced3280 100644 --- a/linux-user/mips/syscall_nr.h +++ b/linux-user/mips/syscall_nr.h @@ -256,7 +256,7 @@ #define TARGET_NR_remap_file_pages (TARGET_NR_Linux + 251) #define TARGET_NR_set_tid_address (TARGET_NR_Linux + 252) #define TARGET_NR_restart_syscall (TARGET_NR_Linux + 253) -#define TARGET_NR_fadvise64 (TARGET_NR_Linux + 254) +#define TARGET_NR_fadvise64_64 (TARGET_NR_Linux + 254) #define TARGET_NR_statfs64 (TARGET_NR_Linux + 255) #define TARGET_NR_fstatfs64 (TARGET_NR_Linux + 256) #define TARGET_NR_timer_create (TARGET_NR_Linux + 257)