summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAleksandar Markovic <aleksandar.markovic@imgtec.com>2016-10-12 14:30:25 +0200
committerRiku Voipio <riku.voipio@linaro.org>2016-10-21 15:20:13 +0300
commit2f2bd444bea156c5ba8dccf3b3b018c770fba03b (patch)
tree945daef1d4582c1237ead181872c6131418923a7
parent6e8b33d89d4f2e9936acc375af3af39b5b6ec4e5 (diff)
downloadfocaccia-qemu-2f2bd444bea156c5ba8dccf3b3b018c770fba03b.tar.gz
focaccia-qemu-2f2bd444bea156c5ba8dccf3b3b018c770fba03b.zip
linux-user: Fix fadvise64() syscall support for Mips32
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 <aleksandar.rikalo@imgtec.com>
Signed-off-by: Miroslav Tisma <miroslav.tisma@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
-rw-r--r--linux-user/mips/syscall_nr.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h
index 6819f865ed..ced32806ea 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)