Received: from eggs.gnu.org ([2001:4830:134:3::10]:34939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7kv3-0005jP-TW for qemu-devel@nongnu.org; Tue, 31 May 2016 10:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7kv2-0001X3-UO for qemu-devel@nongnu.org; Tue, 31 May 2016 10:45:21 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7kv2-0001WP-NS for qemu-devel@nongnu.org; Tue, 31 May 2016 10:45:20 -0400 From: Peter Maydell Date: Tue, 31 May 2016 15:45:09 +0100 Message-Id: <1464705911-28960-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1464705911-28960-1-git-send-email-peter.maydell@linaro.org> References: <1464705911-28960-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 1/3] linux-user: Fix handling of arm_fadvise64_64 syscall List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio 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 --- 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 7d5f123..4894919 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9329,18 +9329,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 -- 1.9.1