Intel 64 and IA-32 Architectures Software Developers Manual Volume 2A, Instruction Set Reference, A-M
3-698 Vol. 2
INSTRUCTION SET REFERENCE, A-M
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 execu-
tion 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 *)
EDX = 0 (* Hints *)
IF ( !trigger_store_happened) {
MONITOR EAX, ECX, EDX
IF ( !trigger_store_happened ) {
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 entensions are processor-specific C-states,
not ACPI C-states
31: 8 Reserved