Overview

The XSAVE feature set comprises eight instructions.

The XSAVE feature set allows saving and loading processor state from a region of memory called an XSAVE area.

XSAVE-enabled features (those features that require use of the XSAVE feature set for their enabling).

The XSAVE feature set supports the saving and restoring of state components, each of which is a discrete set of processor registers (or parts of registers). In general, each such state component corresponds to a particular CPU feature. Such a feature is XSAVE-supported.

The XSAVE feature set organizes the state components of the XSAVE-supported features using state-component bitmaps. A state-component bitmap comprises 64 bits; each bit in such a bitmap corresponds to a single state component. The XSAVE feature set uses state-component bitmaps in multiple ways. Most of the instructions use an implicit operand (in EDX:EAX), called the instruction mask, which is the state-component bitmap that specifies the state components on which the instruction operates.

Some state components are user state components, and they can be managed by the entire XSAVE feature set.

  • Extended control register XCR0 contains a state-component bitmap that specifies the user state components that software has enabled the XSAVE feature set to manage. If the bit corresponding to a state component is clear in XCR0, instructions in the XSAVE feature set will not operate on that state component, regardless of the value of the instruction mask.

Other state components are supervisor state components, and they can be managed only by XSAVES and XRSTORS.

  • The IA32_XSS MSR (index DA0H) contains a state-component bitmap that specifies the supervisor state components that software has enabled XSAVES and XRSTORS to manage (XSAVE, XSAVEC, XSAVEOPT, and XRSTOR cannot manage supervisor state components). If the bit corresponding to a state component is clear in the IA32_XSS MSR, XSAVES and XRSTORS will not operate on that state component, regardless of the value of the instruction mask.

An extension called extended feature disable (XFD) is an extension to the XSAVE feature set that allows an operating system to enable a feature while preventing specific user threads from using the feature.

For each instruction, you can refer to SDM 13.7.

XSETBV—Set Extended Control Register: Writes the contents of registers EDX:EAX into the 64-bit extended control register (XCR) specified in the ECX register.

CPUID/MSR enumeration

CPUID function 0DH, sub-function 1. EAX[0] enumerates support for the XSAVEOPT instruction.

What is dynamic XSTATE components

Application can enable or not enable this feature, like AMX. If we choose to enable AMX XSAVE for each APP, each will use 8K memory so it is too cost, we need to choose enable it or not.

FPU is not dynamic, it is static, because we cannot enable it, it is enabled by default.

Masks

  1. CPUID function 0DH, sub-function 0. EDX:EAX is a bitmap of all the user state components that can be managed using the XSAVE feature set. A bit can be set in XCR0 if and only if the corresponding bit is set in this bitmap.
  2. Extended control register XCR0 contains a state-component bitmap that specifies the user state components that software has enabled the XSAVE feature set to manage. If the bit corresponding to a state component is clear in XCR0, instructions in the XSAVE feature set will not operate on that state component, regardless of the value of the instruction mask.
  3. When XFD is enabled for a state component, any instruction that would access that state component does not execute and instead generates an device-not-available exception (#NM).

XFD (extended feature disable)

The XTILEDATA state component is very large, and an operating system may prefer not to allocate memory for the XTILEDATA state of every user thread. Such an operating system that enables Intel AMX might prefer to prevent specific user threads from using the feature. An extension called extended feature disable (XFD) is added to the XSAVE feature set to support such a usage.

When XFD is enabled for a state component, any instruction that would access that state component does not execute and instead generates an device-not-available exception (#NM).

Misc

XFD is in ISE, not in SDM.