AMD AMD-K6-2/450 Design Guide - Page 70
Testing for the CPUID Instruction, Illegal Instruction Exception Method, EFLAGS IDBit Method
View all AMD AMD-K6-2/450 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 70 highlights
Preliminary Information Embedded AMD-K6™ Processors BIOS Design Guide 23913A/0-November 2000 s Standard functions provide a simple method for software to access information common to all x86 processors. s Extended functions provide information on extensions specific to a vendor's processor (for example, AMD's processors). The flexibility of the CPUID instruction allows for the addition of new CPUID functions in future generations of processors. "Appendix A" on page 71 contains a detailed description of the CPUID instruction. Testing for the CPUID Instruction Illegal Instruction Exception Method EFLAGS ID-Bit Method Beginning with the AMD-K6E processor Model 7, all AMD processors support the CPUID instruction. However, it is still recommended that software verify that the CPUID instruction is supported. To use the CPUID instruction, software must first determine if the processor supports the CPUID instruction. CPUID support is determined in one of the following ways: s Execute the CPUID instruction and check whether an illegal instruction exception occurs. If an exception occurs, the processor does not have CPUID support. s Check if the ID bit (bit 21) of the EFLAGS register is writable. If the bit is writable (that is, it can be modified), the CPUID instruction is supported. The operating system (OS) environment determines which approach is more appropriate. These techniques are described in the following sections. This technique requires a way for a user program to detect and handle illegal instruction exceptions. Where such capabilities are present, this method represents a reliable way of detecting support for the CPUID instruction. The CPUID sample code described on page 67 uses this approach. This technique retrieves the contents of EFLAGS using the PUSHFD instruction, toggles the ID bit, and uses the POPFD instruction to write the modified value of the ID bit into the EFLAGS register. It then retrieves the contents of EFLAGS using a second PUSHFD instruction and checks whether the value of the ID bit differs from the original value. 58 Embedded AMD Processor Recognition