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: 78053 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp891836qge; Tue, 18 Oct 2016 06:42:45 -0700 (PDT) X-Received: by 10.55.184.2 with SMTP id i2mr613152qkf.47.1476798165225; Tue, 18 Oct 2016 06:42:45 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g77si21018499qke.226.2016.10.18.06.42.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:42:45 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUfE-0007Tw-GC for patch@linaro.org; Tue, 18 Oct 2016 09:42:44 -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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.1.4 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)