Example 3-2 Identification Of Sse With Cpuid; Example 3-3 Identification Of Sse By The Os - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

IA-32 Intel® Architecture Optimization
Example 3-2
Identification of SSE with cpuid
...identify existence of cpuid instruction
...
mov eax, 1
cpuid
test EDX, 002000000h
jnz
To find out whether the operating system supports SSE, execute an SSE
instruction and trap for an exception if one occurs. Catching the
exception in a simple try/except clause (using structured exception
handling in C++) and checking whether the exception code is an invalid
opcode will give you the answer. See Example 3-3.
Example 3-3
Identification of SSE by the OS
bool OSSupportCheck() {
_try {
}
_except(EXCEPTION_EXECUTE_HANDLER) {
}
/* SSE are supported by OS */
return (true);
}
3-4
; identify signature is genuine intel
Found
__asm xorps xmm0, xmm0 ;Streaming SIMD Extension
if (_exception_code()==STATUS_ILLEGAL_INSTRUCTION)
/* SSE not supported */
return (false);
; request for feature flags
; 0Fh, 0A2h
; bit 25 in feature flags equal to 1
cpuid instruction

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ARCHITECTURE IA-32 and is the answer not in the manual?

Table of Contents

Save PDF