beautypg.com

Intel 253666-024US User Manual

Page 759

background image

Vol. 2A 3-713

INSTRUCTION SET REFERENCE, A-M

MWAIT—Monitor Wait

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)

If a memory operand effective address is outside the CS, DS,

ES, FS, or GS segment limit.

If the DS, ES, FS, or GS register is used to access memory and it

contains a NULL segment selector.

If ECX = 0.

#SS(0)

If a memory operand effective address is outside the SS

segment limit.

#PF(fault-code)

For a page fault.

#UD

If CPUID.01H:ECX.MONITOR[bit 3] = 0.
If current privilege level is not 0.

Real Address Mode Exceptions

#GP

If any part of the operand in the CS, DS, ES, FS, or GS segment

lies outside of the effective address space from 0 to FFFFH.

If ECX

0.

#SS

If any part of the operand in the SS segment lies outside of the

effective address space from 0 to FFFFH.

#UD

If CPUID.01H:ECX.MONITOR[bit 3] = 0.

Virtual 8086 Mode Exceptions

#UD

The MONITOR instruction is not recognized in virtual-8086 mode

(even if CPUID.01H:ECX.MONITOR[bit 3] = 1).