3-712 Vol. 2A MWAIT—Monitor Wait
INSTRUCTION SET REFERENCE, A-M
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
MONITOR/MWAIT instruction pair 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 *)
Table 3-63. MWAIT Hints Register (EAX)
Bits Description
3 : 0 Sub C-state within a C-state, indicated by bits [7:4]
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 extensions are processor-specific C-states,
not ACPI C-states
31: 8 Reserved