AMD AMD-K6-2/450 Design Guide - Page 77

Detection Algorithm for Determining Instruction Set Support, CPUID Test, Standard Function Test

Page 77 highlights

23913A/0-November 2000 Preliminary Information Embedded AMD-K6™ Processors BIOS Design Guide Detection Algorithm for Determining Instruction Set Support To simplify the detection of the new instructions and the original 3DNow! and MMX instructions, use the following algorithm. A code sample using the CPUID instruction to identify the processor and its features is available from AMD's website at http://www.amd.com/products/cpg/bin. There are other ways to implement detection besides the way shown in the sample. CPUID Test 1. Establish that the processor has support for CPUID. See "Testing for the CPUID Instruction" on page 58. Standard Function Test 2. Execute CPUID function 0, which returns the processor vendor string and the highest standard function supported. Save the vendor string for a later comparison. (See step 9.) 3. If step 2 indicates that the highest standard function is at least 1, execute CPUID function 1, which returns the standard feature flags in the EDX register. MMX™ Test 4. If bit 23 of the standard feature flags is set to 1, MMX technology is supported. MMX instruction support is the basic minimum processor feature required to support other instruction extensions. Optional SSE Test 5. Optionally, if bit 25 of the standard feature flags is set, the processor has streaming single instruction multiple data (SIMD) extensions (SSE) capabilities. Further qualification of SSE is done by checking for OS support. SSE support might be present in the processor, but not usable due to a lack of OS support for the additional architected registers. Extended Functions Test 6. Execute CPUID extended function 8000_0000h. This function returns the highest extended function supported in EAX. If EAX=0, there is no support for extended functions. 7. If the highest extended function supported is at least 8000_0001h, execute CPUID function 8000_0001h. This function returns the extended feature flags in EDX. 3DNow!™ Test 8. If bit 31 of the extended feature flags is set to 1, the 3DNow! instructions are supported. Vendor Check 9. If the previously saved vendor string (see step 2) contains "AuthenticAMD", continue on to the next step. Embedded AMD Processor Recognition 65

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98

Embedded AMD Processor Recognition
65
23913A/0—November 2000
Embedded AMD-K6™ Processors BIOS Design Guide
Preliminary Information
Detection Algorithm for Determining Instruction Set Support
To simplify the detection of the new instructions and the
original 3DNow! and MMX instructions, use the following
algorithm. A code sample using the CPUID instruction to
identify the processor and its features is available from AMD’s
other ways to implement detection besides the way shown in
the sample.
CPUID Test
1.
Establish that the processor has support for CPUID. See
“Testing for the CPUID Instruction” on page 58.
Standard Function
Test
2.
Execute CPUID function 0, which returns the processor
vendor string and the highest standard function supported.
Save the vendor string for a later comparison. (See step 9.)
3.
If step 2 indicates that the highest standard function is at
least 1, execute CPUID function 1, which returns the
standard feature flags in the EDX register.
MMX™ Test
4.
If bit 23 of the standard feature flags is set to 1, MMX
technology is supported. MMX instruction support is the
basic minimum processor feature required to support other
instruction extensions.
Optional SSE Test
5.
Optionally, if bit 25 of the standard feature flags is set, the
processor has streaming single instruction multiple data
(SIMD) extensions (SSE) capabilities. Further qualification
of SSE is done by checking for OS support. SSE support
might be present in the processor, but not usable due to a
lack of OS support for the additional architected registers.
Extended Functions
Test
6.
Execute
CPUID
extended
function
8000_0000h.
This
function returns the highest extended function supported in
EAX. If EAX=0, there is no support for extended functions.
7.
If the highest extended function supported is at least
8000_0001h, execute CPUID function 8000_0001h. This
function returns the extended feature flags in EDX.
3DNow!™ Test
8.
If bit 31 of the extended feature flags is set to 1, the 3DNow!
instructions are supported.
Vendor Check
9.
If the previously saved vendor string (see step 2) contains
“AuthenticAMD”, continue on to the next step.