]> granicus.if.org Git - strace/commitdiff
2004-06-22 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 23 Jun 2004 01:40:45 +0000 (01:40 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 23 Jun 2004 01:40:45 +0000 (01:40 +0000)
* syscall.c (syscall_fixup) [LINUX && X86_64]: For 32-bit process,
sign extend the low 32 bits of RAX to 64 bits.
* syscall.c (force_result): [LINUX && X86_64]: Fix RAX*4 -> RAX*8.

syscall.c

index 5c8a79e818f9559edfa3084fbabcc0a5d56b292f..4264a80d82a39443c11250b6adf5e12ebb181eb9 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1296,6 +1296,8 @@ struct tcb *tcp;
 #elif defined (X86_64)
        if (upeek(pid, 8*RAX, &rax) < 0)
                return -1;
+       if (current_personality == 1)
+               rax = (long int)(int)rax; /* sign extend from 32 bits */
        if (rax != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
                if (debug)
                        fprintf(stderr, "stray syscall exit: rax = %ld\n", rax);
@@ -1615,7 +1617,7 @@ force_result(tcp, error, rval)
 #else /* !I386 */
 #ifdef X86_64
        rax = error ? -error : rval;
-       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(RAX * 4), rax) < 0)
+       if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(RAX * 8), rax) < 0)
                return -1;
 #else
 #ifdef IA64