Skip to content

target-i386: Use C struct for xsave area layout, offsets & sizes

Eduardo Habkost kvm qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 1 replyIn review
  2. v23 patches 5 repliesSuperseded
  3. v13 patches 10 repliesSuperseded

Changes in v3 from the cover letter

* XMM_Q helper is now ZMM_Q
* Added PKRU state

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3target-i386: Define structs for layout of xsave areatarget-i386/cpu.h target-i386/kvm.c+118 -00 replies
2/3target-i386: Use xsave structs for ext_save_areatarget-i386/cpu.c+14 -70 replies
3/3target-i386: kvm: Use X86XSaveArea struct for xsave save/loadtarget-i386/kvm.c+38 -400 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] target-i386: Use C struct for xsave area layout, offsets & sizes

target-i386/cpu.c:ext_save_area uses magic numbers for the xsave area offets and sizes, and target-i386/kvm.c:kvm_{put,get}_xsave() uses offset macros and bit manipulation to access the xsave area. This series changes both to use C structs for those operations.

I still need to figure out a way to write unit tests for the new code. Maybe I will just copy and paste the new and old functions, and test them locally (checking if they give the same results when translating blobs of random bytes).

Changes v1 -> v2:
* Use uint8_t[8*n] instead of uint64_t[n] for register data
* Keep the QEMU_BUILD_BUG_ON lines

Changes v2 -> v3:
* XMM_Q helper is now ZMM_Q
* Added PKRU state

Eduardo Habkost (3):
target-i386: Define structs for layout of xsave area
target-i386: Use xsave structs for ext_save_area
target-i386: kvm: Use X86XSaveArea struct for xsave save/load

 target-i386/cpu.c |  21 ++++++++----
 target-i386/cpu.h |  95 ++++++++++++++++++++++++++++++++++++++++++++++++++
 target-i386/kvm.c | 101 +++++++++++++++++++++++++++++++++---------------------
 3 files changed, 170 insertions(+), 47 deletions(-)
Signature · 1 line
2.1.0