4 * Copyright 1995,1997 Morten Welinder
5 * Copyright 1997-1998 Marcus Meissner
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/port.h"
25 #ifdef HAVE_SYS_PARAM_H
26 # include <sys/param.h>
28 #ifdef HAVE_SYS_SYSCTL_H
29 # include <sys/sysctl.h>
31 #ifdef HAVE_MACHINE_CPU_H
32 # include <machine/cpu.h>
40 #ifdef HAVE_SYS_TIME_H
41 # include <sys/time.h>
45 #define NONAMELESSUNION
46 #define NONAMELESSSTRUCT
53 #include "wine/unicode.h"
54 #include "wine/debug.h"
56 WINE_DEFAULT_DEBUG_CHANNEL(reg
);
58 #define AUTH 0x68747541 /* "Auth" */
59 #define ENTI 0x69746e65 /* "enti" */
60 #define CAMD 0x444d4163 /* "cAMD" */
62 /* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
63 * We are compiled with -fPIC, so we can't clobber ebx.
65 static inline void do_cpuid(int ax
, int *p
)
68 __asm__("pushl %%ebx\n\t"
70 "movl %%ebx, %%esi\n\t"
72 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
77 /* From xf86info havecpuid.c 1.11 */
78 static inline int have_cpuid(void)
92 : "=&r" (f1
), "=&r" (f2
)
94 return ((f1
^f2
) & 0x00200000) != 0;
100 static BYTE PF
[64] = {0,};
101 static ULONGLONG cpuHz
= 1000000000; /* default to a 1GHz */
103 static void create_registry_keys( const SYSTEM_INFO
*info
)
105 static const WCHAR SystemW
[] = {'M','a','c','h','i','n','e','\\',
106 'H','a','r','d','w','a','r','e','\\',
107 'D','e','s','c','r','i','p','t','i','o','n','\\',
108 'S','y','s','t','e','m',0};
109 static const WCHAR fpuW
[] = {'F','l','o','a','t','i','n','g','P','o','i','n','t','P','r','o','c','e','s','s','o','r',0};
110 static const WCHAR cpuW
[] = {'C','e','n','t','r','a','l','P','r','o','c','e','s','s','o','r',0};
111 static const WCHAR IdentifierW
[] = {'I','d','e','n','t','i','f','i','e','r',0};
112 static const WCHAR SysidW
[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0};
113 static const WCHAR mhzKeyW
[] = {'~','M','H','z',0};
114 static const WCHAR VendorIdentifierW
[] = {'V','e','n','d','o','r','I','d','e','n','t','i','f','i','e','r',0};
115 static const WCHAR VenidIntelW
[] = {'G','e','n','u','i','n','e','I','n','t','e','l',0};
116 /* static const WCHAR VenidAMDW[] = {'A','u','t','h','e','n','t','i','c','A','M','D',0}; */
119 HKEY hkey
, system_key
, cpu_key
;
120 OBJECT_ATTRIBUTES attr
;
121 UNICODE_STRING nameW
, valueW
;
123 attr
.Length
= sizeof(attr
);
124 attr
.RootDirectory
= 0;
125 attr
.ObjectName
= &nameW
;
127 attr
.SecurityDescriptor
= NULL
;
128 attr
.SecurityQualityOfService
= NULL
;
130 RtlInitUnicodeString( &nameW
, SystemW
);
131 if (NtCreateKey( &system_key
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
)) return;
133 RtlInitUnicodeString( &valueW
, IdentifierW
);
134 NtSetValueKey( system_key
, &valueW
, 0, REG_SZ
, SysidW
, (strlenW(SysidW
)+1) * sizeof(WCHAR
) );
136 attr
.RootDirectory
= system_key
;
137 RtlInitUnicodeString( &nameW
, fpuW
);
138 if (!NtCreateKey( &hkey
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
)) NtClose( hkey
);
140 RtlInitUnicodeString( &nameW
, cpuW
);
141 if (!NtCreateKey( &cpu_key
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
))
143 for (i
= 0; i
< info
->dwNumberOfProcessors
; i
++)
145 char num
[10], id
[20];
147 attr
.RootDirectory
= cpu_key
;
148 sprintf( num
, "%d", i
);
149 RtlCreateUnicodeStringFromAsciiz( &nameW
, num
);
150 if (!NtCreateKey( &hkey
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
))
153 DWORD cpuMHz
= cpuHz
/ 1000000;
155 /*TODO: report 64bit processors properly*/
156 RtlInitUnicodeString( &valueW
, IdentifierW
);
157 sprintf( id
, "x86 Family %d Model %d Stepping %d",
158 info
->wProcessorLevel
/*model and family are messed up*/, info
->wProcessorLevel
, info
->wProcessorRevision
);
160 RtlMultiByteToUnicodeN( idW
, sizeof(idW
), NULL
, id
, strlen(id
)+1 );
161 NtSetValueKey( hkey
, &valueW
, 0, REG_SZ
, idW
, (strlenW(idW
)+1)*sizeof(WCHAR
) );
163 /*TODO; report amd's properly*/
164 RtlInitUnicodeString( &valueW
, VendorIdentifierW
);
165 NtSetValueKey( hkey
, &valueW
, 0, REG_SZ
, VenidIntelW
, (strlenW(VenidIntelW
)+1) * sizeof(WCHAR
) );
167 RtlInitUnicodeString( &valueW
, mhzKeyW
);
168 NtSetValueKey( hkey
, &valueW
, 0, REG_DWORD
, &cpuMHz
, sizeof(DWORD
) );
171 RtlFreeUnicodeString( &nameW
);
175 NtClose( system_key
);
178 /****************************************************************************
179 * QueryPerformanceCounter (KERNEL32.@)
181 * Get the current value of the performance counter.
184 * counter [O] Destination for the current counter reading
187 * Success: TRUE. counter contains the current reading
191 * See QueryPerformanceFrequency.
193 BOOL WINAPI
QueryPerformanceCounter(PLARGE_INTEGER counter
)
195 LARGE_INTEGER frequency
;
196 NtQueryPerformanceCounter( counter
, &frequency
);
201 /****************************************************************************
202 * QueryPerformanceFrequency (KERNEL32.@)
204 * Get the resolution of the performace counter.
207 * frequency [O] Destination for the counter resolution
210 * Success. TRUE. Frequency contains the resolution of the counter.
214 * See QueryPerformanceCounter.
216 BOOL WINAPI
QueryPerformanceFrequency(PLARGE_INTEGER frequency
)
218 LARGE_INTEGER counter
;
219 NtQueryPerformanceCounter( &counter
, frequency
);
224 /***********************************************************************
225 * GetSystemInfo [KERNEL32.@]
227 * Get information about the system.
233 * On the first call it creates cached values, so it doesn't have to determine
234 * them repeatedly. On Linux, the "/proc/cpuinfo" special file is used.
236 * It creates a registry subhierarchy, looking like:
237 * "\HARDWARE\DESCRIPTION\System\CentralProcessor\<processornumber>\Identifier (CPU x86)".
238 * Note that there is a hierarchy for every processor installed, so this
239 * supports multiprocessor systems. This is done like Win95 does it, I think.
241 * It also creates a cached flag array for IsProcessorFeaturePresent().
243 VOID WINAPI
GetSystemInfo(
244 LPSYSTEM_INFO si
/* [out] Destination for system information, may not be NULL */)
246 static int cache
= 0;
247 static SYSTEM_INFO cachedsi
;
249 TRACE("si=0x%p\n", si
);
251 memcpy(si
,&cachedsi
,sizeof(*si
));
254 memset(PF
,0,sizeof(PF
));
256 /* choose sensible defaults ...
257 * FIXME: perhaps overrideable with precompiler flags?
259 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_INTEL
;
260 cachedsi
.dwPageSize
= getpagesize();
262 /* FIXME: the two entries below should be computed somehow... */
263 cachedsi
.lpMinimumApplicationAddress
= (void *)0x00010000;
264 cachedsi
.lpMaximumApplicationAddress
= (void *)0x7FFFFFFF;
265 cachedsi
.dwActiveProcessorMask
= 1;
266 cachedsi
.dwNumberOfProcessors
= 1;
267 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
268 cachedsi
.dwAllocationGranularity
= 0x10000;
269 cachedsi
.wProcessorLevel
= 5; /* 586 */
270 cachedsi
.wProcessorRevision
= 0;
272 cache
= 1; /* even if there is no more info, we now have a cacheentry */
273 memcpy(si
,&cachedsi
,sizeof(*si
));
275 /* Hmm, reasonable processor feature defaults? */
280 FILE *f
= fopen ("/proc/cpuinfo", "r");
284 while (fgets(line
,200,f
)!=NULL
) {
287 /* NOTE: the ':' is the only character we can rely on */
288 if (!(value
= strchr(line
,':')))
291 /* terminate the valuename */
293 while ((s
>= line
) && ((*s
== ' ') || (*s
== '\t'))) s
--;
296 /* and strip leading spaces from value */
298 while (*value
==' ') value
++;
299 if ((s
=strchr(value
,'\n')))
303 if (!strcasecmp(line
, "cpu family")) {
304 if (isdigit (value
[0])) {
305 switch (value
[0] - '0') {
306 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
307 cachedsi
.wProcessorLevel
= 3;
309 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
310 cachedsi
.wProcessorLevel
= 4;
312 case 5: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
313 cachedsi
.wProcessorLevel
= 5;
315 case 6: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
316 cachedsi
.wProcessorLevel
= 6;
318 case 1: /* two-figure levels */
321 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
322 cachedsi
.wProcessorLevel
= 6;
327 FIXME("unknown cpu family '%s', please report ! (-> setting to 386)\n", value
);
334 if (!strcasecmp(line
, "cpu")) {
335 if ( isdigit (value
[0]) && value
[1] == '8' &&
336 value
[2] == '6' && value
[3] == 0
338 switch (value
[0] - '0') {
339 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
340 cachedsi
.wProcessorLevel
= 3;
342 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
343 cachedsi
.wProcessorLevel
= 4;
345 case 5: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
346 cachedsi
.wProcessorLevel
= 5;
348 case 6: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
349 cachedsi
.wProcessorLevel
= 6;
352 FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value
);
358 if (!strcasecmp(line
,"fdiv_bug")) {
359 if (!strncasecmp(value
,"yes",3))
360 PF
[PF_FLOATING_POINT_PRECISION_ERRATA
] = TRUE
;
364 if (!strcasecmp(line
,"fpu")) {
365 if (!strncasecmp(value
,"no",2))
366 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
370 if (!strcasecmp(line
,"processor")) {
371 /* processor number counts up... */
374 if (sscanf(value
,"%d",&x
))
375 if (x
+1>cachedsi
.dwNumberOfProcessors
)
376 cachedsi
.dwNumberOfProcessors
=x
+1;
380 if (!strcasecmp(line
,"stepping")) {
383 if (sscanf(value
,"%d",&x
))
384 cachedsi
.wProcessorRevision
= x
;
388 if (!strcasecmp(line
, "cpu MHz")) {
390 if (sscanf( value
, "%lf", &cmz
) == 1) {
391 /* SYSTEMINFO doesn't have a slot for cpu speed, so store in a global */
392 cpuHz
= cmz
* 1000 * 1000;
393 TRACE("CPU speed read as %lld\n", cpuHz
);
397 if ( !strcasecmp(line
,"flags") ||
398 !strcasecmp(line
,"features")
400 if (strstr(value
,"cx8"))
401 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
402 if (strstr(value
,"mmx"))
403 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
404 if (strstr(value
,"tsc"))
405 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
406 if (strstr(value
,"3dnow"))
407 PF
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
408 /* This will also catch sse2, but we have sse itself
409 * if we have sse2, so no problem */
410 if (strstr(value
,"sse"))
411 PF
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
412 if (strstr(value
,"sse2"))
413 PF
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
414 if (strstr(value
,"pae"))
415 PF
[PF_PAE_ENABLED
] = TRUE
;
422 memcpy(si
,&cachedsi
,sizeof(*si
));
423 #elif defined (__NetBSD__)
429 FILE *f
= fopen ("/var/run/dmesg.boot", "r");
431 /* first deduce as much as possible from the sysctls */
432 mib
[0] = CTL_MACHDEP
;
433 #ifdef CPU_FPU_PRESENT
434 mib
[1] = CPU_FPU_PRESENT
;
435 value
[1] = sizeof(int);
436 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
437 if (value
) PF
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
438 else PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
441 mib
[1] = CPU_SSE
; /* this should imply MMX */
442 value
[1] = sizeof(int);
443 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
444 if (value
) PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
447 mib
[1] = CPU_SSE2
; /* this should imply MMX */
448 value
[1] = sizeof(int);
449 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
450 if (value
) PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
454 value
[1] = sizeof(int);
455 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
456 if (value
[0] > cachedsi
.dwNumberOfProcessors
)
457 cachedsi
.dwNumberOfProcessors
= value
[0];
460 if (sysctl(mib
, 2, model
, value
+1, NULL
, 0) >= 0) {
461 model
[value
[1]] = '\0'; /* just in case */
462 cpuclass
= strstr(model
, "-class");
463 if (cpuclass
!= NULL
) {
464 while(cpuclass
> model
&& cpuclass
[0] != '(') cpuclass
--;
465 if (!strncmp(cpuclass
+1, "386", 3)) {
466 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
467 cachedsi
.wProcessorLevel
= 3;
469 if (!strncmp(cpuclass
+1, "486", 3)) {
470 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
471 cachedsi
.wProcessorLevel
= 4;
473 if (!strncmp(cpuclass
+1, "586", 3)) {
474 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
475 cachedsi
.wProcessorLevel
= 5;
477 if (!strncmp(cpuclass
+1, "686", 3)) {
478 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
479 cachedsi
.wProcessorLevel
= 6;
480 /* this should imply MMX */
481 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
486 /* it may be worth reading from /var/run/dmesg.boot for
487 additional information such as CX8, MMX and TSC
488 (however this information should be considered less
489 reliable than that from the sysctl calls) */
492 while (fgets(model
, 255, f
) != NULL
) {
493 if (sscanf(model
,"cpu%d: features %x<", value
, value
+1) == 2) {
494 /* we could scan the string but it is easier
495 to test the bits directly */
497 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
499 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
500 if (value
[1] & 0x100)
501 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
502 if (value
[1] & 0x800000)
503 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
512 memcpy(si
,&cachedsi
,sizeof(*si
));
513 #elif defined(__FreeBSD__)
515 unsigned int regs
[4], regs2
[4];
518 regs
[0] = 0; /* No cpuid support -- skip the rest */
520 do_cpuid(0x00000000, regs
); /* get standard cpuid level and vendor name */
521 if (regs
[0]>=0x00000001) { /* Check for supported cpuid version */
522 do_cpuid(0x00000001, regs2
); /* get cpu features */
523 switch ((regs2
[0] >> 8)&0xf) { /* cpu family */
524 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
525 cachedsi
.wProcessorLevel
= 3;
527 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
528 cachedsi
.wProcessorLevel
= 4;
531 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
532 cachedsi
.wProcessorLevel
= 5;
535 case 15: /* PPro/2/3/4 has same info as P1 */
536 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
537 cachedsi
.wProcessorLevel
= 6;
540 FIXME("unknown FreeBSD cpu family %d, please report! (-> setting to 386)\n", \
541 (regs2
[0] >> 8)&0xf);
544 PF
[PF_FLOATING_POINT_EMULATED
] = !(regs2
[3] & 1);
545 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = (regs2
[3] & (1 << 4 )) >> 4;
546 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = (regs2
[3] & (1 << 8 )) >> 8;
547 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 23)) >> 23;
548 /* Check for OS support of SSE -- Is this used, and should it be sse1 or sse2? */
550 ret = sysctlbyname("hw.instruction_sse", &num, &len, NULL, 0);
552 PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = num;*/
554 if (regs
[1] == AUTH
&&
557 do_cpuid(0x80000000, regs
); /* get vendor cpuid level */
558 if (regs
[0]>=0x80000001) {
559 do_cpuid(0x80000001, regs2
); /* get vendor features */
560 PF
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] =
561 (regs2
[3] & (1 << 31 )) >> 31;
566 ret
= sysctlbyname("hw.ncpu", &num
, &len
, NULL
, 0);
568 cachedsi
.dwNumberOfProcessors
= num
;
570 memcpy(si
,&cachedsi
,sizeof(*si
));
571 #elif defined (__APPLE__)
574 unsigned long long longVal
;
578 valSize
= sizeof(int);
579 if (sysctlbyname ("hw.optional.floatingpoint", &value
, &valSize
, NULL
, 0) == 0)
582 PF
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
584 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
586 valSize
= sizeof(int);
587 if (sysctlbyname ("hw.ncpu", &value
, &valSize
, NULL
, 0) == 0)
588 cachedsi
.dwNumberOfProcessors
= value
;
590 valSize
= sizeof(int);
591 if (sysctlbyname ("hw.activecpu", &value
, &valSize
, NULL
, 0) == 0)
592 cachedsi
.dwActiveProcessorMask
= value
;
594 valSize
= sizeof(int);
595 if (sysctlbyname ("hw.cputype", &cputype
, &valSize
, NULL
, 0) == 0)
597 valSize
= sizeof(int);
598 if (sysctlbyname ("hw.cpusubtype", &value
, &valSize
, NULL
, 0) == 0)
602 case CPU_TYPE_POWERPC
:
603 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_PPC
;
606 case CPU_SUBTYPE_POWERPC_601
:
607 case CPU_SUBTYPE_POWERPC_602
:
608 cachedsi
.dwProcessorType
= PROCESSOR_PPC_601
;
609 cachedsi
.wProcessorLevel
= 1;
611 case CPU_SUBTYPE_POWERPC_603
:
612 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
613 cachedsi
.wProcessorLevel
= 3;
615 case CPU_SUBTYPE_POWERPC_603e
:
616 case CPU_SUBTYPE_POWERPC_603ev
:
617 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
618 cachedsi
.wProcessorLevel
= 6;
620 case CPU_SUBTYPE_POWERPC_604
:
621 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
622 cachedsi
.wProcessorLevel
= 4;
624 case CPU_SUBTYPE_POWERPC_604e
:
625 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
626 cachedsi
.wProcessorLevel
= 9;
628 case CPU_SUBTYPE_POWERPC_620
:
629 cachedsi
.dwProcessorType
= PROCESSOR_PPC_620
;
630 cachedsi
.wProcessorLevel
= 20;
632 case CPU_SUBTYPE_POWERPC_750
:
633 case CPU_SUBTYPE_POWERPC_7400
:
634 case CPU_SUBTYPE_POWERPC_7450
:
635 /* G3/G4 derivate from 603 so ... */
636 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
637 cachedsi
.wProcessorLevel
= 6;
639 case CPU_SUBTYPE_POWERPC_970
:
640 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
641 cachedsi
.wProcessorLevel
= 9;
642 /* :o) PF[PF_ALTIVEC_INSTRUCTIONS_AVAILABLE] ;-) */
646 break; /* CPU_TYPE_POWERPC */
648 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_INTEL
;
651 case CPU_SUBTYPE_386
:
652 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
653 cachedsi
.wProcessorLevel
= 3;
655 case CPU_SUBTYPE_486
:
656 case CPU_SUBTYPE_486SX
:
657 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
658 cachedsi
.wProcessorLevel
= 4;
660 case CPU_SUBTYPE_586
:
661 case CPU_SUBTYPE_PENTPRO
:
662 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
663 cachedsi
.wProcessorLevel
= 5;
665 case CPU_SUBTYPE_PENTII_M3
:
666 case CPU_SUBTYPE_PENTII_M5
:
667 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
668 cachedsi
.wProcessorLevel
= 5;
669 /* this should imply MMX */
670 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
674 break; /* CPU_TYPE_I386 */
676 } /* switch (cputype) */
679 valSize
= sizeof(longVal
);
680 if (!sysctlbyname("hw.cpufrequency", &longVal
, &valSize
, NULL
, 0))
683 memcpy(si
,&cachedsi
,sizeof(*si
));
685 FIXME("not yet supported on this system\n");
687 TRACE("<- CPU arch %d, res'd %d, pagesize %ld, minappaddr %p, maxappaddr %p,"
688 " act.cpumask %08lx, numcpus %ld, CPU type %ld, allocgran. %ld, CPU level %d, CPU rev %d\n",
689 si
->u
.s
.wProcessorArchitecture
, si
->u
.s
.wReserved
, si
->dwPageSize
,
690 si
->lpMinimumApplicationAddress
, si
->lpMaximumApplicationAddress
,
691 si
->dwActiveProcessorMask
, si
->dwNumberOfProcessors
, si
->dwProcessorType
,
692 si
->dwAllocationGranularity
, si
->wProcessorLevel
, si
->wProcessorRevision
);
694 create_registry_keys( &cachedsi
);
698 /***********************************************************************
699 * IsProcessorFeaturePresent [KERNEL32.@]
701 * Determine if the cpu supports a given feature.
704 * TRUE, If the processor supports feature,
707 BOOL WINAPI
IsProcessorFeaturePresent (
708 DWORD feature
/* [in] Feature number, (PF_ constants from "winnt.h") */)
711 GetSystemInfo (&si
); /* To ensure the information is loaded and cached */