From patchwork Tue Oct 18 13:21:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9382157 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 4D0A260839 for ; Tue, 18 Oct 2016 13:40:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CB9428A0E for ; Tue, 18 Oct 2016 13:40:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 319F7295E0; Tue, 18 Oct 2016 13:40:59 +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 4F1D428A0E for ; Tue, 18 Oct 2016 13:40:57 +0000 (UTC) Received: from localhost ([::1]:41592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUdU-00061E-Gp for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Oct 2016 09:40:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULT-0006Ub-TE for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwULR-0000kn-Dz for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:19 -0400 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:33920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwULR-0000kH-56 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:17 -0400 Received: by mail-lf0-x22c.google.com with SMTP id b81so343457190lfe.1 for ; Tue, 18 Oct 2016 06:22:17 -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=PVH89XSxMPixWgwyibk0VMUyzigHo+NIMUolr1el9zNvVydvIYz/+vNrEPjIxst+uu zKOhjro0biWBOqTI5CAkuTuDb5oLTfw4ydH7axz7xWObc1M11nfhQQyUv7nd58W6U62N GTNr2So+r0Whmrj70h+4ROiekY2a7d1SZUVEA= 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=XOf+loPVZmFwd5MfWntGGcNnjMrTBJHaTw1RZZSZClhCYaNRDZnTA34ALB9Ybj1jfC pAmLvybJ2iFjWAQHZLJEAz+RkjEvOgCWwkdiyUXbui3UuOuOIrUtvs/WwqxdZO9TCc3Q Wzjo7m9KgSUy++HCFgKMHVlrBlIk/JCFyHhuoQx3hK7Dh0oFwOzYWagH21hJpD6WfG1Q vet+fQnr0jl97G/Oqhc85xTM4NupMKY2FD/6ySSDkDIqF5Qh0ZsR07b9oQLjsvTEO4c+ QpUWwMOw+G5KaeqVTh8jjBVFH/uQ/bnWmY5VvDajk/Ey8SfOemap+SLb+djm/dFSI1Bl a5Rw== X-Gm-Message-State: AA6/9RlltZ2kNzJKxH1m8sn1/MXdTHbUt5mrAUC2xzX4PTyVTmjbK1aK3gkDeGuEyu5v+ZYW X-Received: by 10.25.196.85 with SMTP id u82mr481037lff.125.1476796934325; Tue, 18 Oct 2016 06:22:14 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 201sm9535359ljf.48.2016.10.18.06.22.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:22:13 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 18 Oct 2016 16:21:47 +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::22c Subject: [Qemu-devel] [PULL v2 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)