comparison cpudetect.c @ 2281:faf96aeb93ef

fixed?
author arpi
date Fri, 19 Oct 2001 13:09:26 +0000
parents b318387bfeda
children baea37ed31f9
comparison
equal deleted inserted replaced
2280:b318387bfeda 2281:faf96aeb93ef
88 bzero(caps, sizeof(*caps)); 88 bzero(caps, sizeof(*caps));
89 printf("CPUid available: %s\n",has_cpuid()?"yes":"no"); 89 printf("CPUid available: %s\n",has_cpuid()?"yes":"no");
90 /*if (!has_cpuid()) 90 /*if (!has_cpuid())
91 return;*/ 91 return;*/
92 do_cpuid(0x00000000, regs); 92 do_cpuid(0x00000000, regs);
93 printf("CPU vendor name: %.4s%.4s%.4s\n",&regs[1],&regs[3],&regs[2]); 93 printf("CPU vendor name: %.4s%.4s%.4s cpuid level: %d\n",&regs[1],&regs[3],&regs[2],regs[0]);
94 // if (regs[0]>0x00000001) 94 if (regs[0]>0x00000001)
95 { 95 {
96 do_cpuid(0x00000001, regs2); 96 do_cpuid(0x00000001, regs2);
97 printf("CPU family: %d\n",(regs2[0] >> 8)&0xf); 97 printf("CPU family: %d\n",(regs2[0] >> 8)&0xf);
98 switch ((regs2[0] >> 8)&0xf) { 98 switch ((regs2[0] >> 8)&0xf) {
99 case 3: 99 case 3:
107 break; 107 break;
108 case 6: 108 case 6:
109 caps->cpuType=CPUTYPE_I686; 109 caps->cpuType=CPUTYPE_I686;
110 break; 110 break;
111 default: 111 default:
112 caps->cpuType=CPUTYPE_I386;
112 printf("Unknown cpu type, default to i386\n"); 113 printf("Unknown cpu type, default to i386\n");
113 break; 114 break;
114 } 115 }
115 caps->hasMMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000 116 caps->hasMMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000
116 117
134 regs[3] == 0x69746e65 && 135 regs[3] == 0x69746e65 &&
135 regs[2] == 0x444d4163) { 136 regs[2] == 0x444d4163) {
136 do_cpuid(0x80000000, regs); 137 do_cpuid(0x80000000, regs);
137 if (regs[0]>=0x80000001) { 138 if (regs[0]>=0x80000001) {
138 do_cpuid(0x80000001, regs2); 139 do_cpuid(0x80000001, regs2);
139 caps->hasMMX2 = (regs[3] & (1 << 22 )) >> 22; // 0x400000 140 caps->hasMMX = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000
141 caps->hasMMX2 = (regs2[3] & (1 << 22 )) >> 22; // 0x400000
140 caps->has3DNow = (regs2[3] & (1 << 31 )) >> 31; //0x80000000 142 caps->has3DNow = (regs2[3] & (1 << 31 )) >> 31; //0x80000000
141 caps->has3DNowExt = (regs2[3] & (1 << 30 )) >> 30; 143 caps->has3DNowExt = (regs2[3] & (1 << 30 )) >> 30;
142 } 144 }
143 } 145 }
144 #if 0 146 #if 0