ia-32_instruction-set-ref_a-m

Simd floating point exception and cr4osxmmexcptbit 10

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: implementations may implement several optimized "waiting" states and will select among those states based on the hint argument. Table 3-62 describes the meaning of ECX and EAX registers for MWAIT extensions. Table 3-62. MWAIT Extension Register (ECX) Bits 0 31: 1 Description Treat Interrupt as break-event, even when interrupts are disabled (EFLAGS.IF=0) Reserved Vol. 2 3-697 INSTRUCTION SET REFERENCE, A-M Table 3-63. MWAIT Hints Register (EAX) Bits 3:0 7:4 Description Sub C-state within a C-state, indicated by bits [7:4] Target C-state* Value of 0 means C1; 1 means C2 and so on Value of 01111B means C0 Note: Target C states for MWAIT entensions are processor-specific C-states, not ACPI C-states 31: 8 Reserved Note that if MWAIT is used to enter any of the C-states that are numerically higher than C1, a store to the address range armed by the MONITOR instruction will cause the processor to exit MWAIT only if the store was originated by other processor agents. A store from non-processor agent may not cause the processor to exit MWAIT in such cases For additional details of MWAIT extensions, see Chapter 13, "Power and Thermal Management," of Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A. Operation (* MWAIT takes the argument in EAX as a hint extension and is architected to take the argument in ECX as an instruction extension MWAIT EAX, ECX *) { WHILE (! ("Monitor Hardware is in armed state")) { implementation_dependent_optimized_state(EAX, ECX); } Set the state of Monitor Hardware as triggered; } Intel C/C++ Compiler Intrinsic Equivalent MWAIT void _mm_mwait(unsigned extensions, unsigned hints) Example The Monitor and MWAIT instructions must be coded in the same loop because execution of the MWAIT instruction will trigger the monitor hardware. It is not a proper usage to execute MONITOR once and then execute MWAIT in a loop. Setting up MONITOR without executing MWAIT has no adverse effects. Typically the MONITOR/MWAIT pair is used in a sequence, such as: EAX = Logical Address(Trigger) ECX = 0 (*Hints *) 3-698 Vol. 2 INSTRUCTION SET REFERENCE, A-M EDX = 0 (* Hints *) IF ( !trigger_store_happened) { MONITOR EAX, ECX, EDX IF ( !trigger_store_happened ) { MWAIT EAX, ECX } } The above code sequence makes sure that a triggering store does not happen between the first check of the trigger and the execution of the monitor instruction. Without the second check that triggering store would go un-noticed. Typical usage of MONITOR and MWAIT would have the above code sequence within a loop. Numeric Exceptions None. Protected Mode Exceptions #GP(0) #UD If ECX 0 and CPUID.05H.ECX[0] = 0. If CPUID.01H:ECX.MONITOR[bit 3] = 0. If executed at privilege level 1 through 3 when the instruction is not available. If LOCK prefixes are used. If REPE, REPNE or operand size prefixes are used. Real Address Mode Exceptions #GP(0) #UD For ECX 0 and CPUID.05H.ECX[0] = 0. If CPUID.01H:ECX.MONITOR[bit 3] = 0. If LOCK prefix is...
View Full Document

This note was uploaded on 10/01/2013 for the course CPE 103 taught by Professor Watlins during the Winter '11 term at Mississippi State.

Ask a homework question - tutors are online