Messages in this thread | | | From | "Bae, Chang Seok" <> | Subject | Re: [PATCH v9 10/26] x86/fpu/xstate: Update the XSTATE buffer address finder to support dynamic states | Date | Mon, 30 Aug 2021 23:38:37 +0000 |
| |
On Aug 30, 2021, at 10:18, Borislav Petkov <bp@alien8.de> wrote: > On Wed, Aug 18, 2021 at 07:47:04PM +0000, Bae, Chang Seok wrote: >> It was refactored to use in the new helper to find feature_nr’s start point. > > Which new helper? > >> If the size is added up here, it is not ‘i’'s start point anymore. > > Yeah, sorry, I have only a very slight idea what you mean here - you'll > have to try again.
Just recap what is said on SDM, Vol1 13.4.3 Extended Region of an XSAVE Area:
- In the compacted format, each state component i is located at a byte offset from the base address of the XSAVE area. - location_i is determined by location_j and size_j, where j is in 1 < j < i and the greatest value XCOMP_BV[j] = 1: location_i = location_j + size_j (let's simplify without the 64-byte alignment here)
This loop was moved from calculate_xstate_buf_size_from_mask() (if renamed) to here in the new helper -- get_xstate_comp_offset().
But the returned value is different. get_xstate_comp_offset(mask, i) should return the location_i but calculate_xstate_buf_size_from_mask(mask) calculates the buffer size which is location_i + size_i when the greatest feature number is i.
Thanks, Chang | |