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

Mark Kettenis
2010-04-07T15:19:56Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

> Date: Wed, 7 Apr 2010 08:04:17 -0700
> From: "H.J. Lu" <hjl.tools@gmail.com>
>
> On Wed, Apr 7, 2010 at 7:55 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > On Wed, Apr 7, 2010 at 3:13 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> >>>
> >>> XSAVE is different from FXSAVE in some subtle ways, although
> >>> XSAVE memory layout is an extension to FXSAVE memory layout.
> >>> XSAVE has used or initialized states for SSE and AVX registers.
> >>> Most of the codes in i387_collect_xsave deal with used/initialized states.
> >>>
> >>> Please identify the duplication of code in i387_collect_xsave. I will take
> >>> a look.
> >>
> >> There is in if (gcore) { } else { } there, that has quite a bit of
> >> duplicated code.  I may be missing something, but the fact that
> >> i387_collect_xsave() does different things whether it is generating a
> >> core file or not seems to be undesirable and wrong to me.
> >>
> >
> > I will take a look.
> >
>
> That is xstate_bv optimization. xstate_bv controls how vector registers
> are restored via xsave. If we will eventually call xsave, we set up xstate_bv
> such that xsave will do minimum work to properly restore vector registers.
> If it is for gcore, we don't need to optimize xstate_bv. Of course, we can
> always optimize xstate_bv even for gcore. I can do that if it is desired.

Please do; for generating core files, you should just call
i387_collect_xsave(..., -1, ...).