Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Лаб2012 / 319433-011.pdf
Скачиваний:
27
Добавлен:
02.02.2015
Размер:
2.31 Mб
Скачать

 

 

 

 

 

SYSTEM PROGRAMMING MODEL

 

Table 3-8. XSAVE Action on MXCSR, XMM, YMM Register

 

 

 

 

 

 

 

 

 

EDX:EAX

XFEATURE_ENABL

 

YMM_H

 

 

ED_MASK

MXCSR

XMM Registers

 

 

Registers

Bit 2

Bit 1

Bit 2

Bit 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

X

X

None

None

 

None

 

 

 

 

 

 

 

 

0

1

X

1

Store

None

 

Store

 

 

 

 

 

 

 

 

0

1

X

0

None

None

 

None

 

 

 

 

 

 

 

 

1

0

0

X

None

None

 

None

 

 

 

 

 

 

 

 

1

0

1

1

Store

Store

 

None

 

 

 

 

 

 

 

 

1

1

0

0

None

None

 

None

 

 

 

 

 

 

 

 

1

1

0

1

Store

None

 

Store

 

 

 

 

 

 

 

 

1

1

1

1

Store

Store

 

Store

 

 

 

 

 

 

 

 

3.2.6Processor Extended State Save Optimization and XSAVEOPT

The XSAVEOPT instruction paired with XRSTOR is designed to provide a high performance method for system software to perform state save and restore.

A processor may indicate its support for the XSAVEOPT instruction if CPUID.(EAX=0DH, ECX=1):EAX.XSAVEOPT[Bit 0] = 1. The functionality of XSAVEOPT is similar to XSAVE. Software can use XSAVEOPT/XRSTOR in a pair-wise manner similar to XSAVE/XRSTOR to save and restore processor extended states.

The syntax and operands for XSAVEOPT instructions are identical to XSAVE, i.e. the mask operand in EDX:EAX specifies the subset of enabled features to be saved.

Note that software using XSAVEOPT must observe the same restrictions as XSAVE while allocating a new save area. i.e., the header area must be initialized to zeroes. The first 64-bits in the save image header starting at offset 512 are referred to as XHEADER.BV. However, the instruction differs from XSAVE in several important aspects:

1.If a component state in the processor specified by the save mask corresponds to an INIT state, the instruction may clear the corresponding bit in XHEADER.BV, but may not write out the state (unlike the XSAVE instruction, which always writes out the state).

2.If the processor determines that the component state specified by the save mask hasn't been modified since the last XRSTOR, the instruction may not write out the state to the save area.

3.A implication of this optimization is that software which needs to examine the saved image must first check the XHEADER.BV to see if any bits are clear. If the

Ref. # 319433-011

3-7

SYSTEM PROGRAMMING MODEL

header bit is clear, it means that the state is INIT and the saved memory image may not correspond to the actual processor state.

4.The performance of XSAVEOPT will always be better than or at least equal to that of XSAVE.

3.2.6.1XSAVEOPT Usage Guidelines

When using the XSAVEOPT facility, software must be aware of the following guidelines:

1.The processor uses a tracking mechanism to determine which state components will be written to memory by the XSAVEOPT instruction. The mechanism includes three sub-conditions that are recorded internally each time XRSTOR is executed and evaluated on the invocation of the next XSAVEOPT. If a change is detected in any one of these sub-conditions, XSAVEOPT will behave exactly as XSAVE. The three sub-conditions are:

current CPL of the logical processor

indication whether or not the logical processor is in VMX non-root operation

linear address of the XSAVE/XRSTOR area

2.Upon allocation of a new XSAVE/XRSTOR area and before an XSAVE or XSAVEOPT instruction is used, the save area header (HEADER.XSTATE) must be initialized to zeroes for proper operation.

3.XSAVEOPT is designed primarily for use in context switch operations. The values stored by the XSAVEOPT instruction depend on the values previously stored in a given XSAVE area.

4.Manual modifications to the XSAVE area between an XRSTOR instruction and the matching XSAVEOPT may result in data corruption.

5.For optimization to be performed properly, the XRSTOR XSAVEOPT pair must use the same segment when referencing the XSAVE area and the base of that segment must be unchanged between the two operations.

6.Software should avoid executing XSAVEOPT into a buffer from which it hadn’t previously executed a XRSTOR. For newly allocated buffers, software can execute XRSTOR with the linear address of the buffer and a restore mask of EDX:EAX = 0. Executing XRSTOR(0:0) doesn’t restore any state, but ensures expected operation of the XSAVEOPT instruction.

7.The XSAVE area can be moved or even paged, but the contents at the linear address of the save area at an XSAVEOPT must be the same as that when the previous XRSTOR was performed.

A destination operand not aligned to 64-byte boundary (in either 64-bit or 32-bit modes) will result in a general-protection (#GP) exception being generated. In 64-bit mode the upper 32 bits of RDX and RAX are ignored.

3-8

Ref. # 319433-011

Соседние файлы в папке Лаб2012