Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture

12-8 Vol. 1
PROGRAMMING WITH SSE3 AND SUPPLEMENTAL SSE3
application attempts to use the MONITOR and MWAIT instructions, the application
should use the following steps:
1. Check that the processor supports MONITOR and MWAIT. If
CPUID.01H:ECX.MONITOR[bit 3] = 1, MONITOR and MWAIT are available at
ring 0.
2. To verify MONITOR and MWAIT is supported at ring level greater than 0, use a
routine similar to Example 12-2.
3. Query the smallest and largest line size that MONITOR uses. Use
CPUID.05H:EAX.smallest[bits 15:0];EBX.largest[bits15:0]. Values are returned
in bytes in EAX and EBX.
4. Ensure the memory address range(s) that will be supplied to MONITOR meets
memory type requirements.
MONITOR and MWAIT are targeted for system software that supports efficient thread
synchronization, See Chapter 12 in the Intel® 64 and IA-32 Architectures Software
Developer’s Manual, Volume 3A for details.
Example 12-1. Verifying SSE3 Support
boolean SSE3_SIMD_works = TRUE;
try {
IssueSSE3_SIMD_Instructions();
// Use ADDSUBPD
}
except (UNWIND)
{
// if we get here, SSE3 not available
SSE3_SIMD_works = FALSE;
}
Example 12-2. Verifying MONITOR/MWAIT Support
boolean MONITOR_MWAIT_works = TRUE;
try {
_asm {
xor ecx, ecx
xor edx, edx
mov eax, MemArea
monitor
}
// Use monitor
}
except (UNWIND)
{