Ver Fonte

linux-user: register align p{read, write}64

pread64 and pwrite64 pass 64bit parameters which for some architectures need
to be aligned to special argument pairs, creating a gap argument.

Handle this special case the same way we handle it in other places of the code.

Reported-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Alex Barcelo <abarcelo@ac.upc.edu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Alexander Graf há 13 anos atrás
pai
commit
ae017a5b95
1 ficheiros alterados com 8 adições e 0 exclusões
  1. 8 0
      linux-user/syscall.c

+ 8 - 0
linux-user/syscall.c

@@ -7467,12 +7467,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #endif
 #ifdef TARGET_NR_pread64
 #ifdef TARGET_NR_pread64
     case TARGET_NR_pread64:
     case TARGET_NR_pread64:
+        if (regpairs_aligned(cpu_env)) {
+            arg4 = arg5;
+            arg5 = arg6;
+        }
         if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
         if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
             goto efault;
             goto efault;
         ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
         ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
         unlock_user(p, arg2, ret);
         unlock_user(p, arg2, ret);
         break;
         break;
     case TARGET_NR_pwrite64:
     case TARGET_NR_pwrite64:
+        if (regpairs_aligned(cpu_env)) {
+            arg4 = arg5;
+            arg5 = arg6;
+        }
         if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
         if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
             goto efault;
             goto efault;
         ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
         ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));