[rfa] Handle amd64-linux %orig_rax

Datoda datoda@yahoo.com
Tue Oct 31 20:10:00 GMT 2006


I think i386 shouldn't have the same problems, as far as gdb inferior calls are concerned, because arguments are passed in stack rather than in registers. 

----- Original Message ----
From: Andi Kleen <ak@suse.de>
To: Daniel Jacobowitz <drow@false.org>
Cc: Datoda <datoda@yahoo.com>; gdb-patches@sourceware.org
Sent: Tuesday, October 31, 2006 1:40:38 PM
Subject: Re: [rfa] Handle amd64-linux %orig_rax


On Tuesday 31 October 2006 19:22, Daniel Jacobowitz wrote:
> Andi, have you got any opinion on this?  The problem arises when GDB
> sets %orig_rax to -1 to indicate that the interrupted syscall should
> not be resumed, and then sets %rip to some other address; the kernel is
> still changing %rcx on the way out to userspace.  I think this sounds
> like a kernel bug.

You would need to complain to the x86 ISA designers.

SYSRET requires us to trash %rcx, there is no other way to use it.
This means IRET won't clobber any registers (and it is used in a few
situations where this is critical), but it is significantly slower.

Ok in theory we could check if the process is traced and then
always use IRET, but then you would get different behaviour
depending on being traced or not which is probably not
a good idea.

BTW on i386 which uses SYSEXIT sometimes there are likely similar
problems. SYSEXIT also requires to clobber registers.

-Andi




More information about the Gdb-patches mailing list