fill the specified structure with information obtained from asm code
| 46 | |
| 47 | // fill the specified structure with information obtained from asm code |
| 48 | void SetProcessorInfo(Platform::SystemInfo_struct::Processor& pInfo, |
| 49 | char* vendor, U32 processor, U32 properties, U32 properties2) |
| 50 | { |
| 51 | Platform::SystemInfo.processor.properties |= (properties & BIT_FPU) ? CPU_PROP_FPU : 0; |
| 52 | Platform::SystemInfo.processor.properties |= (properties & BIT_RDTSC) ? CPU_PROP_RDTSC : 0; |
| 53 | Platform::SystemInfo.processor.properties |= (properties & BIT_MMX) ? CPU_PROP_MMX : 0; |
| 54 | |
| 55 | if (dStricmp(vendor, "GenuineIntel") == 0) |
| 56 | { |
| 57 | pInfo.properties |= (properties & BIT_SSE) ? CPU_PROP_SSE : 0; |
| 58 | pInfo.properties |= (properties & BIT_SSE2) ? CPU_PROP_SSE2 : 0; |
| 59 | pInfo.properties |= (properties2 & BIT_SSE3) ? CPU_PROP_SSE3 : 0; |
| 60 | pInfo.properties |= (properties2 & BIT_SSE3xt) ? CPU_PROP_SSE3xt : 0; |
| 61 | pInfo.properties |= (properties2 & BIT_SSE4_1) ? CPU_PROP_SSE4_1 : 0; |
| 62 | pInfo.properties |= (properties2 & BIT_SSE4_2) ? CPU_PROP_SSE4_2 : 0; |
| 63 | |
| 64 | pInfo.type = CPU_Intel_Unknown; |
| 65 | // switch on processor family code |
| 66 | switch ((processor >> 8) & 0x0f) |
| 67 | { |
| 68 | case 4: |
| 69 | pInfo.type = CPU_Intel_486; |
| 70 | pInfo.name = StringTable->insert("Intel 486 class"); |
| 71 | break; |
| 72 | |
| 73 | // Pentium Family |
| 74 | case 5: |
| 75 | // switch on processor model code |
| 76 | switch ((processor >> 4) & 0xf) |
| 77 | { |
| 78 | case 1: |
| 79 | case 2: |
| 80 | case 3: |
| 81 | pInfo.type = CPU_Intel_Pentium; |
| 82 | pInfo.name = StringTable->insert("Intel Pentium"); |
| 83 | break; |
| 84 | case 4: |
| 85 | pInfo.type = CPU_Intel_PentiumMMX; |
| 86 | pInfo.name = StringTable->insert("Intel Pentium MMX"); |
| 87 | break; |
| 88 | default: |
| 89 | pInfo.type = CPU_Intel_Pentium; |
| 90 | pInfo.name = StringTable->insert( "Intel (unknown)" ); |
| 91 | break; |
| 92 | } |
| 93 | break; |
| 94 | |
| 95 | // Pentium Pro/II/II family |
| 96 | case 6: |
| 97 | { |
| 98 | U32 extendedModel = ( processor & 0xf0000 ) >> 16; |
| 99 | // switch on processor model code |
| 100 | switch ((processor >> 4) & 0xf) |
| 101 | { |
| 102 | case 1: |
| 103 | pInfo.type = CPU_Intel_PentiumPro; |
| 104 | pInfo.name = StringTable->insert("Intel Pentium Pro"); |
| 105 | break; |
no test coverage detected