From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20794 invoked by alias); 27 Jul 2011 19:26:43 -0000 Received: (qmail 20785 invoked by uid 22791); 27 Jul 2011 19:26:42 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jul 2011 19:26:28 +0000 Received: (qmail 14030 invoked from network); 27 Jul 2011 19:26:28 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Jul 2011 19:26:28 -0000 From: Pedro Alves To: Tom Tromey , "H.J. Lu" Subject: Re: RFC: partially available registers Date: Wed, 27 Jul 2011 19:33:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) Cc: gdb-patches@sourceware.org, Daniel Jacobowitz References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201107272026.24532.pedro@codesourcery.com> 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: 2011-07/txt/msg00780.txt.bz2 On Wednesday 27 July 2011 20:08:26, Tom Tromey wrote: > Pedro> ... but I think that we should go with 0, instead of , > Pedro> meaning changing x87-tdep.c:i387_supply_xsave to supply > Pedro> explicity zeroed buffer, instead of a NULL pointer, like > Pedro> gdbserver does. > > Tom> I will do this. > > Here's the patch. Thanks. Why only the AVX state though? There are several other places in the same function that pass NULL to regcache_raw_supply that I think should get the same treatment. i387_supply_xsave accepts and handles a NULL XSAVE argument. I suppose it's for cores that miss the xsave section? I can't quite tell what path ends up calling i387_supply_xsave with NULL. Maybe it's dead code (I remember this code having changed a bit the design throughout the review iterations; this bit may have been left behind). If not dead, that may be a genuine case for . > > In absence of comment I will check it in, in a couple of days. > > Built and regtested by the buildbot. > > Tom > > 2011-07-27 Tom Tromey > > * i387-tdep.c (i387_supply_xsave): Supply zero for high bits of > AVX registers. > > diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c > index c4ace82..332d491 100644 > --- a/gdb/i387-tdep.c > +++ b/gdb/i387-tdep.c > @@ -798,17 +798,26 @@ i387_supply_xsave (struct regcache *regcache, int regnum, > /* Handle the upper YMM registers. */ > if ((tdep->xcr0 & I386_XSTATE_AVX)) > { > + gdb_byte buf[MAX_REGISTER_SIZE]; > + > if ((clear_bv & I386_XSTATE_AVX)) > - p = NULL; > + { > + memset (buf, 0, sizeof (buf)); > + p = NULL; > + } > else > p = regs; > > for (i = I387_YMM0H_REGNUM (tdep); > i < I387_YMMENDH_REGNUM (tdep); i++) > { > + const void *arg; > + > if (p != NULL) > - p = XSAVE_AVXH_ADDR (tdep, regs, i); > - regcache_raw_supply (regcache, i, p); > + arg = XSAVE_AVXH_ADDR (tdep, regs, i); > + else > + arg = buf; > + regcache_raw_supply (regcache, i, arg); > } > } > > -- Pedro Alves