From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20021 invoked by alias); 31 Oct 2006 18:40:58 -0000 Received: (qmail 20013 invoked by uid 22791); 31 Oct 2006 18:40:57 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 31 Oct 2006 18:40:48 +0000 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2D2781FCE0; Tue, 31 Oct 2006 19:40:41 +0100 (CET) From: Andi Kleen To: Daniel Jacobowitz Subject: Re: [rfa] Handle amd64-linux %orig_rax Date: Tue, 31 Oct 2006 18:40:00 -0000 User-Agent: KMail/1.9.5 Cc: Datoda , gdb-patches@sourceware.org References: <20061031181702.73135.qmail@web53714.mail.yahoo.com> <20061031182209.GA29639@nevyn.them.org> In-Reply-To: <20061031182209.GA29639@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610311940.38617.ak@suse.de> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00315.txt.bz2 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