Re: PATCH: 3/6 [2nd try]: Add AVX support (i386 changes)

H.J. Lu
2010-03-29T21:41:24Z

On Mon, Mar 29, 2010 at 1:32 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Sun, 28 Mar 2010 07:24:53 -0700
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> > Anyway, how about setting the size of the .reg-xstate to
>> > I386_XSTATE_SSE_SIZE unconditionally?  Tools will look at xcr0 value
>> > encoded in there to determine what information in there is valid, so
>> > dumping a little bit more than strictly necessary shouldn't be a
>> > problem.
>>
>> That will make the code more complex since the generic gcore
>> implementation will have to adjust section size based on XCR0.
>> But if it is what is required, I will make the change.
>
> Sorry, I think you're missing my point here.  The idea is to make
> gcore always write out a NT_XSTATE note that has the maximal size
> (I386_XSTATE_MAX_SIZE, I now see I typed the wrong thing above).  Then
> when you write out the section, you fill the bits that aren't used
> with zeroes and make sure the value of xcr0 stored in there is set
> correctly.
>

i386-linux-tdep.c has

---
/* Update XSAVE extended state register note section. */

void
i386_linux_update_xstateregset (unsigned int xstate_size)
{
struct core_regset_section *xstate = &i386_linux_regset_sections[3];

/* Update the XSAVE extended state register note section for "gcore".
Disable it if its size is 0. */
gdb_assert (strcmp (xstate->sect_name, ".reg-xstate") == 0);
if (xstate_size)
xstate->size = xstate_size;
else
xstate->sect_name = NULL;
}
---

Even if I set xstate_size to I386_XSTATE_MAX_SIZE, I still need to
call it to set sect_name to NULL when the XSAVE extended state isn't
available. Please let me know if this is what you want.

Thanks.

--
H.J.