From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8867 invoked by alias); 30 Mar 2007 15:33:54 -0000 Received: (qmail 8849 invoked by uid 22791); 30 Mar 2007 15:33:53 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 30 Mar 2007 16:33:43 +0100 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id 4A6254B267; Fri, 30 Mar 2007 10:33:42 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id 312F74B262; Fri, 30 Mar 2007 10:33:42 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HXJ6j-0002TC-De; Fri, 30 Mar 2007 11:33:41 -0400 Date: Fri, 30 Mar 2007 15:33:00 -0000 From: Daniel Jacobowitz To: qunyingpan@gmail.com Cc: gdb-patches@sourceware.org Subject: Re: Patch: Fix ftag error when it is restored from fxsave in gdbserver on x86 Message-ID: <20070330153341.GD14014@caradoc.them.org> Mail-Followup-To: qunyingpan@gmail.com, gdb-patches@sourceware.org References: <000001c5df07$39c341f0$9c0a000a@Nora> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c5df07$39c341f0$9c0a000a@Nora> User-Agent: Mutt/1.5.14+cvs20070313 (2007-03-13) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00362.txt.bz2 On Tue, Nov 01, 2005 at 09:10:57AM -0800, Qunying Pan wrote: > Hello, > > Sent out to gdb-patches@sources.redhat.com yesterday, but did not get > through I guess. Try again to gdb-patches@sourceware.org. > > This patch fixes ftag error when it is restored from fxsave in gdbserver > on x86. Acceptable? I've only belatedly had a chance to look at this :-( I ended up using a different patch, but thank you for your work - it was easy to see what I'd done (completely) wrong when I wrote the fxsave support. There was a similar error in the other direction. Tested on x86_64-linux using gdbserver, where it fixes a failure in store.exp. -- Daniel Jacobowitz CodeSourcery 2007-03-30 Daniel Jacobowitz * i387-fp.c (i387_cache_to_fxsave): Reinitialize val2 before use. (i387_fxsave_to_cache): Check fp->ftag while building ftag value. Index: i387-fp.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/i387-fp.c,v retrieving revision 1.5 diff -u -p -r1.5 i387-fp.c --- i387-fp.c 9 Jan 2007 17:59:08 -0000 1.5 +++ i387-fp.c 30 Mar 2007 15:28:45 -0000 @@ -174,6 +174,7 @@ i387_cache_to_fxsave (void *buf) /* Convert to the simplifed tag form stored in fxsave data. */ collect_register_by_name ("ftag", &val); val &= 0xFFFF; + val2 = 0; for (i = 7; i >= 0; i--) { int tag = (val >> (i * 2)) & 3; @@ -270,7 +271,7 @@ i387_fxsave_to_cache (const void *buf) for (i = 7; i >= 0; i--) { int tag; - if (val & (1 << i)) + if (fp->ftag & (1 << i)) tag = i387_ftag (fp, (i + 8 - top) % 8); else tag = 3;