qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/4] linux-user: Fix fadvise64() syscall support for


From: Aleksandar Markovic
Subject: [Qemu-devel] [PATCH 4/4] linux-user: Fix fadvise64() syscall support for Mips32
Date: Tue, 4 Oct 2016 20:05:12 +0200

From: Aleksandar Markovic <address@hidden>

By looking at the file arch/mips/kernel/sys.S in Linux kernel,
it can be deduced that, for Mips32 platform, syscall
corresponding to number _NR_fadvise64 translates to kernel
function sys_fadvise64_64, and that argument layout is as
follows:
          0             32 0             32
         +----------------+----------------+
  (arg1) |       fd       |     __pad      | (arg2)
         +----------------+----------------+
  (arg3) |             buffer              | (arg4)
         +----------------+----------------+
  (arg5) |               len               | (arg6)
         +----------------+----------------+
  (arg7) |     advise     |    not used    | (arg8)
         +----------------+----------------+

This can be deduced from glibc code as well, and relevant commits
in linux kernel and glibc.

Mips32 uniqness is that it does not define _NR_fadvise64_64,
however its fadvise64 implemantation is identical to
fadvise64_64 impleanentation on most other platforms.

This patch also fixes the failure LTP test posix_fadvise03, if
executed on Qemu-emulated Mips32 platform (user mode).

Signed-off-by: Aleksandar Rikalo <address@hidden>
Signed-off-by: Miroslav Tisma <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
---
 linux-user/syscall.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fe8042c..a246bf1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10929,6 +10929,13 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
arg1,
 
 #ifdef TARGET_NR_fadvise64
     case TARGET_NR_fadvise64:
+#ifdef TARGET_MIPS
+        ret = -host_to_target_errno(
+                  posix_fadvise64(arg1,
+                                  target_offset64(arg3, arg4),
+                                  target_offset64(arg5, arg6),
+                                  arg7));
+#else
         /* 5 args: fd, offset (high, low), len, advice */
         if (regpairs_aligned(cpu_env)) {
             /* offset is in (3,4), len in 5 and advice in 6 */
@@ -10940,6 +10947,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
arg1,
         ret = -host_to_target_errno(posix_fadvise(arg1,
                                                   target_offset64(arg2, arg3),
                                                   arg4, arg5));
+#endif
         break;
 #endif
 
-- 
2.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]