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>
34 #ifdef HAVE_MACH_MACHINE_H
35 # include <mach/machine.h>
43 #ifdef HAVE_SYS_TIME_H
44 # include <sys/time.h>
48 #define NONAMELESSUNION
49 #define NONAMELESSSTRUCT
55 #include "wine/unicode.h"
56 #include "wine/debug.h"
58 WINE_DEFAULT_DEBUG_CHANNEL(reg
);
60 #define AUTH 0x68747541 /* "Auth" */
61 #define ENTI 0x69746e65 /* "enti" */
62 #define CAMD 0x444d4163 /* "cAMD" */
64 /* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
65 * We are compiled with -fPIC, so we can't clobber ebx.
67 static inline void do_cpuid(int ax
, int *p
)
70 __asm__("pushl %%ebx\n\t"
72 "movl %%ebx, %%esi\n\t"
74 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
79 /* From xf86info havecpuid.c 1.11 */
80 static inline int have_cpuid(void)
94 : "=&r" (f1
), "=&r" (f2
)
96 return ((f1
^f2
) & 0x00200000) != 0;
102 static BYTE PF
[64] = {0,};
103 static ULONGLONG cpuHz
= 1000000000; /* default to a 1GHz */
105 static void create_registry_keys( const SYSTEM_INFO
*info
)
107 static const WCHAR SystemW
[] = {'M','a','c','h','i','n','e','\\',
108 'H','a','r','d','w','a','r','e','\\',
109 'D','e','s','c','r','i','p','t','i','o','n','\\',
110 'S','y','s','t','e','m',0};
111 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};
112 static const WCHAR cpuW
[] = {'C','e','n','t','r','a','l','P','r','o','c','e','s','s','o','r',0};
113 static const WCHAR IdentifierW
[] = {'I','d','e','n','t','i','f','i','e','r',0};
114 static const WCHAR SysidW
[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0};
115 static const WCHAR mhzKeyW
[] = {'~','M','H','z',0};
116 static const WCHAR VendorIdentifierW
[] = {'V','e','n','d','o','r','I','d','e','n','t','i','f','i','e','r',0};
117 static const WCHAR VenidIntelW
[] = {'G','e','n','u','i','n','e','I','n','t','e','l',0};
118 /* static const WCHAR VenidAMDW[] = {'A','u','t','h','e','n','t','i','c','A','M','D',0}; */
121 HANDLE hkey
, system_key
, cpu_key
;
122 OBJECT_ATTRIBUTES attr
;
123 UNICODE_STRING nameW
, valueW
;
125 attr
.Length
= sizeof(attr
);
126 attr
.RootDirectory
= 0;
127 attr
.ObjectName
= &nameW
;
129 attr
.SecurityDescriptor
= NULL
;
130 attr
.SecurityQualityOfService
= NULL
;
132 RtlInitUnicodeString( &nameW
, SystemW
);
133 if (NtCreateKey( &system_key
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
)) return;
135 RtlInitUnicodeString( &valueW
, IdentifierW
);
136 NtSetValueKey( system_key
, &valueW
, 0, REG_SZ
, SysidW
, (strlenW(SysidW
)+1) * sizeof(WCHAR
) );
138 attr
.RootDirectory
= system_key
;
139 RtlInitUnicodeString( &nameW
, fpuW
);
140 if (!NtCreateKey( &hkey
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
)) NtClose( hkey
);
142 RtlInitUnicodeString( &nameW
, cpuW
);
143 if (!NtCreateKey( &cpu_key
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
))
145 for (i
= 0; i
< info
->dwNumberOfProcessors
; i
++)
147 char num
[10], id
[60];
149 attr
.RootDirectory
= cpu_key
;
150 sprintf( num
, "%d", i
);
151 RtlCreateUnicodeStringFromAsciiz( &nameW
, num
);
152 if (!NtCreateKey( &hkey
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
))
155 DWORD cpuMHz
= cpuHz
/ 1000000;
157 /*TODO: report 64bit processors properly*/
158 RtlInitUnicodeString( &valueW
, IdentifierW
);
159 sprintf( id
, "x86 Family %d Model %d Stepping %d",
160 info
->wProcessorLevel
/*model and family are messed up*/, info
->wProcessorLevel
, info
->wProcessorRevision
);
162 RtlMultiByteToUnicodeN( idW
, sizeof(idW
), NULL
, id
, strlen(id
)+1 );
163 NtSetValueKey( hkey
, &valueW
, 0, REG_SZ
, idW
, (strlenW(idW
)+1)*sizeof(WCHAR
) );
165 /*TODO; report amd's properly*/
166 RtlInitUnicodeString( &valueW
, VendorIdentifierW
);
167 NtSetValueKey( hkey
, &valueW
, 0, REG_SZ
, VenidIntelW
, (strlenW(VenidIntelW
)+1) * sizeof(WCHAR
) );
169 RtlInitUnicodeString( &valueW
, mhzKeyW
);
170 NtSetValueKey( hkey
, &valueW
, 0, REG_DWORD
, &cpuMHz
, sizeof(DWORD
) );
173 RtlFreeUnicodeString( &nameW
);
177 NtClose( system_key
);
180 /****************************************************************************
181 * QueryPerformanceCounter (KERNEL32.@)
183 * Get the current value of the performance counter.
186 * counter [O] Destination for the current counter reading
189 * Success: TRUE. counter contains the current reading
193 * See QueryPerformanceFrequency.
195 BOOL WINAPI
QueryPerformanceCounter(PLARGE_INTEGER counter
)
197 NtQueryPerformanceCounter( counter
, NULL
);
202 /****************************************************************************
203 * QueryPerformanceFrequency (KERNEL32.@)
205 * Get the resolution of the performace counter.
208 * frequency [O] Destination for the counter resolution
211 * Success. TRUE. Frequency contains the resolution of the counter.
215 * See QueryPerformanceCounter.
217 BOOL WINAPI
QueryPerformanceFrequency(PLARGE_INTEGER frequency
)
219 LARGE_INTEGER counter
;
220 NtQueryPerformanceCounter( &counter
, frequency
);
225 /***********************************************************************
226 * GetSystemInfo [KERNEL32.@]
228 * Get information about the system.
234 * On the first call it creates cached values, so it doesn't have to determine
235 * them repeatedly. On Linux, the "/proc/cpuinfo" special file is used.
237 * It creates a registry subhierarchy, looking like:
238 * "\HARDWARE\DESCRIPTION\System\CentralProcessor\<processornumber>\Identifier (CPU x86)".
239 * Note that there is a hierarchy for every processor installed, so this
240 * supports multiprocessor systems. This is done like Win95 does it, I think.
242 * It also creates a cached flag array for IsProcessorFeaturePresent().
244 VOID WINAPI
GetSystemInfo(
245 LPSYSTEM_INFO si
/* [out] Destination for system information, may not be NULL */)
247 static int cache
= 0;
248 static SYSTEM_INFO cachedsi
;
250 TRACE("si=0x%p\n", si
);
252 memcpy(si
,&cachedsi
,sizeof(*si
));
255 memset(PF
,0,sizeof(PF
));
257 /* choose sensible defaults ...
258 * FIXME: perhaps overrideable with precompiler flags?
260 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_INTEL
;
261 cachedsi
.dwPageSize
= getpagesize();
263 /* FIXME: the two entries below should be computed somehow... */
264 cachedsi
.lpMinimumApplicationAddress
= (void *)0x00010000;
265 cachedsi
.lpMaximumApplicationAddress
= (void *)0x7FFFFFFF;
266 cachedsi
.dwActiveProcessorMask
= 1;
267 cachedsi
.dwNumberOfProcessors
= 1;
268 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
269 cachedsi
.dwAllocationGranularity
= 0x10000;
270 cachedsi
.wProcessorLevel
= 5; /* 586 */
271 cachedsi
.wProcessorRevision
= 0;
273 cache
= 1; /* even if there is no more info, we now have a cacheentry */
274 memcpy(si
,&cachedsi
,sizeof(*si
));
276 /* Hmm, reasonable processor feature defaults? */
281 FILE *f
= fopen ("/proc/cpuinfo", "r");
285 while (fgets(line
,200,f
)!=NULL
) {
288 /* NOTE: the ':' is the only character we can rely on */
289 if (!(value
= strchr(line
,':')))
292 /* terminate the valuename */
294 while ((s
>= line
) && ((*s
== ' ') || (*s
== '\t'))) s
--;
297 /* and strip leading spaces from value */
299 while (*value
==' ') value
++;
300 if ((s
=strchr(value
,'\n')))
304 if (!strcasecmp(line
, "cpu family")) {
305 if (isdigit (value
[0])) {
306 switch (value
[0] - '0') {
307 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
308 cachedsi
.wProcessorLevel
= 3;
310 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
311 cachedsi
.wProcessorLevel
= 4;
313 case 5: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
314 cachedsi
.wProcessorLevel
= 5;
316 case 6: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
317 cachedsi
.wProcessorLevel
= 6;
319 case 1: /* two-figure levels */
322 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
323 cachedsi
.wProcessorLevel
= 6;
328 FIXME("unknown cpu family '%s', please report ! (-> setting to 386)\n", value
);
335 if (!strcasecmp(line
, "cpu")) {
336 if ( isdigit (value
[0]) && value
[1] == '8' &&
337 value
[2] == '6' && value
[3] == 0
339 switch (value
[0] - '0') {
340 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
341 cachedsi
.wProcessorLevel
= 3;
343 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
344 cachedsi
.wProcessorLevel
= 4;
346 case 5: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
347 cachedsi
.wProcessorLevel
= 5;
349 case 6: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
350 cachedsi
.wProcessorLevel
= 6;
353 FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value
);
359 if (!strcasecmp(line
,"fdiv_bug")) {
360 if (!strncasecmp(value
,"yes",3))
361 PF
[PF_FLOATING_POINT_PRECISION_ERRATA
] = TRUE
;
365 if (!strcasecmp(line
,"fpu")) {
366 if (!strncasecmp(value
,"no",2))
367 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
371 if (!strcasecmp(line
,"processor")) {
372 /* processor number counts up... */
375 if (sscanf(value
,"%d",&x
))
376 if (x
+1>cachedsi
.dwNumberOfProcessors
)
377 cachedsi
.dwNumberOfProcessors
=x
+1;
381 if (!strcasecmp(line
,"stepping")) {
384 if (sscanf(value
,"%d",&x
))
385 cachedsi
.wProcessorRevision
= x
;
389 if (!strcasecmp(line
, "cpu MHz")) {
391 if (sscanf( value
, "%lf", &cmz
) == 1) {
392 /* SYSTEMINFO doesn't have a slot for cpu speed, so store in a global */
393 cpuHz
= cmz
* 1000 * 1000;
394 TRACE("CPU speed read as %lld\n", cpuHz
);
398 if ( !strcasecmp(line
,"flags") ||
399 !strcasecmp(line
,"features")
401 if (strstr(value
,"cx8"))
402 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
403 if (strstr(value
,"mmx"))
404 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
405 if (strstr(value
,"tsc"))
406 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
407 if (strstr(value
,"3dnow"))
408 PF
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
409 /* This will also catch sse2, but we have sse itself
410 * if we have sse2, so no problem */
411 if (strstr(value
,"sse"))
412 PF
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
413 if (strstr(value
,"sse2"))
414 PF
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
415 if (strstr(value
,"pae"))
416 PF
[PF_PAE_ENABLED
] = TRUE
;
423 memcpy(si
,&cachedsi
,sizeof(*si
));
424 #elif defined (__NetBSD__)
430 FILE *f
= fopen ("/var/run/dmesg.boot", "r");
432 /* first deduce as much as possible from the sysctls */
433 mib
[0] = CTL_MACHDEP
;
434 #ifdef CPU_FPU_PRESENT
435 mib
[1] = CPU_FPU_PRESENT
;
436 value
[1] = sizeof(int);
437 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
438 if (value
) PF
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
439 else PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
442 mib
[1] = CPU_SSE
; /* this should imply MMX */
443 value
[1] = sizeof(int);
444 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
445 if (value
) PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
448 mib
[1] = CPU_SSE2
; /* this should imply MMX */
449 value
[1] = sizeof(int);
450 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
451 if (value
) PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
455 value
[1] = sizeof(int);
456 if (sysctl(mib
, 2, value
, value
+1, NULL
, 0) >= 0)
457 if (value
[0] > cachedsi
.dwNumberOfProcessors
)
458 cachedsi
.dwNumberOfProcessors
= value
[0];
461 if (sysctl(mib
, 2, model
, value
+1, NULL
, 0) >= 0) {
462 model
[value
[1]] = '\0'; /* just in case */
463 cpuclass
= strstr(model
, "-class");
464 if (cpuclass
!= NULL
) {
465 while(cpuclass
> model
&& cpuclass
[0] != '(') cpuclass
--;
466 if (!strncmp(cpuclass
+1, "386", 3)) {
467 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
468 cachedsi
.wProcessorLevel
= 3;
470 if (!strncmp(cpuclass
+1, "486", 3)) {
471 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
472 cachedsi
.wProcessorLevel
= 4;
474 if (!strncmp(cpuclass
+1, "586", 3)) {
475 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
476 cachedsi
.wProcessorLevel
= 5;
478 if (!strncmp(cpuclass
+1, "686", 3)) {
479 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
480 cachedsi
.wProcessorLevel
= 6;
481 /* this should imply MMX */
482 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
487 /* it may be worth reading from /var/run/dmesg.boot for
488 additional information such as CX8, MMX and TSC
489 (however this information should be considered less
490 reliable than that from the sysctl calls) */
493 while (fgets(model
, 255, f
) != NULL
) {
494 if (sscanf(model
,"cpu%d: features %x<", value
, value
+1) == 2) {
495 /* we could scan the string but it is easier
496 to test the bits directly */
498 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
500 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
501 if (value
[1] & 0x100)
502 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
503 if (value
[1] & 0x800000)
504 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
513 memcpy(si
,&cachedsi
,sizeof(*si
));
514 #elif defined(__FreeBSD__)
516 unsigned int regs
[4], regs2
[4];
519 regs
[0] = 0; /* No cpuid support -- skip the rest */
521 do_cpuid(0x00000000, regs
); /* get standard cpuid level and vendor name */
522 if (regs
[0]>=0x00000001) { /* Check for supported cpuid version */
523 do_cpuid(0x00000001, regs2
); /* get cpu features */
524 switch ((regs2
[0] >> 8)&0xf) { /* cpu family */
525 case 3: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
526 cachedsi
.wProcessorLevel
= 3;
528 case 4: cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
529 cachedsi
.wProcessorLevel
= 4;
532 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
533 cachedsi
.wProcessorLevel
= 5;
536 case 15: /* PPro/2/3/4 has same info as P1 */
537 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
538 cachedsi
.wProcessorLevel
= 6;
541 FIXME("unknown FreeBSD cpu family %d, please report! (-> setting to 386)\n", \
542 (regs2
[0] >> 8)&0xf);
545 PF
[PF_FLOATING_POINT_EMULATED
] = !(regs2
[3] & 1);
546 PF
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = (regs2
[3] & (1 << 4 )) >> 4;
547 PF
[PF_COMPARE_EXCHANGE_DOUBLE
] = (regs2
[3] & (1 << 8 )) >> 8;
548 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 23)) >> 23;
549 /* Check for OS support of SSE -- Is this used, and should it be sse1 or sse2? */
551 ret = sysctlbyname("hw.instruction_sse", &num, &len, NULL, 0);
553 PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = num;*/
555 if (regs
[1] == AUTH
&&
558 do_cpuid(0x80000000, regs
); /* get vendor cpuid level */
559 if (regs
[0]>=0x80000001) {
560 do_cpuid(0x80000001, regs2
); /* get vendor features */
561 PF
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] =
562 (regs2
[3] & (1 << 31 )) >> 31;
567 ret
= sysctlbyname("hw.ncpu", &num
, &len
, NULL
, 0);
569 cachedsi
.dwNumberOfProcessors
= num
;
571 memcpy(si
,&cachedsi
,sizeof(*si
));
572 #elif defined (__APPLE__)
575 unsigned long long longVal
;
579 valSize
= sizeof(int);
580 if (sysctlbyname ("hw.optional.floatingpoint", &value
, &valSize
, NULL
, 0) == 0)
583 PF
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
585 PF
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
587 valSize
= sizeof(int);
588 if (sysctlbyname ("hw.ncpu", &value
, &valSize
, NULL
, 0) == 0)
589 cachedsi
.dwNumberOfProcessors
= value
;
591 valSize
= sizeof(int);
592 if (sysctlbyname ("hw.activecpu", &value
, &valSize
, NULL
, 0) == 0)
593 cachedsi
.dwActiveProcessorMask
= value
;
595 valSize
= sizeof(int);
596 if (sysctlbyname ("hw.cputype", &cputype
, &valSize
, NULL
, 0) == 0)
598 valSize
= sizeof(int);
599 if (sysctlbyname ("hw.cpusubtype", &value
, &valSize
, NULL
, 0) == 0)
603 case CPU_TYPE_POWERPC
:
604 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_PPC
;
607 case CPU_SUBTYPE_POWERPC_601
:
608 case CPU_SUBTYPE_POWERPC_602
:
609 cachedsi
.dwProcessorType
= PROCESSOR_PPC_601
;
610 cachedsi
.wProcessorLevel
= 1;
612 case CPU_SUBTYPE_POWERPC_603
:
613 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
614 cachedsi
.wProcessorLevel
= 3;
616 case CPU_SUBTYPE_POWERPC_603e
:
617 case CPU_SUBTYPE_POWERPC_603ev
:
618 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
619 cachedsi
.wProcessorLevel
= 6;
621 case CPU_SUBTYPE_POWERPC_604
:
622 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
623 cachedsi
.wProcessorLevel
= 4;
625 case CPU_SUBTYPE_POWERPC_604e
:
626 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
627 cachedsi
.wProcessorLevel
= 9;
629 case CPU_SUBTYPE_POWERPC_620
:
630 cachedsi
.dwProcessorType
= PROCESSOR_PPC_620
;
631 cachedsi
.wProcessorLevel
= 20;
633 case CPU_SUBTYPE_POWERPC_750
:
634 case CPU_SUBTYPE_POWERPC_7400
:
635 case CPU_SUBTYPE_POWERPC_7450
:
636 /* G3/G4 derivate from 603 so ... */
637 cachedsi
.dwProcessorType
= PROCESSOR_PPC_603
;
638 cachedsi
.wProcessorLevel
= 6;
640 case CPU_SUBTYPE_POWERPC_970
:
641 cachedsi
.dwProcessorType
= PROCESSOR_PPC_604
;
642 cachedsi
.wProcessorLevel
= 9;
643 /* :o) PF[PF_ALTIVEC_INSTRUCTIONS_AVAILABLE] ;-) */
647 break; /* CPU_TYPE_POWERPC */
649 cachedsi
.u
.s
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_INTEL
;
652 case CPU_SUBTYPE_386
:
653 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
654 cachedsi
.wProcessorLevel
= 3;
656 case CPU_SUBTYPE_486
:
657 case CPU_SUBTYPE_486SX
:
658 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
659 cachedsi
.wProcessorLevel
= 4;
661 case CPU_SUBTYPE_586
:
662 case CPU_SUBTYPE_PENTPRO
:
663 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
664 cachedsi
.wProcessorLevel
= 5;
666 case CPU_SUBTYPE_PENTII_M3
:
667 case CPU_SUBTYPE_PENTII_M5
:
668 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
669 cachedsi
.wProcessorLevel
= 5;
670 /* this should imply MMX */
671 PF
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
675 break; /* CPU_TYPE_I386 */
677 } /* switch (cputype) */
680 valSize
= sizeof(longVal
);
681 if (!sysctlbyname("hw.cpufrequency", &longVal
, &valSize
, NULL
, 0))
684 memcpy(si
,&cachedsi
,sizeof(*si
));
686 FIXME("not yet supported on this system\n");
688 TRACE("<- CPU arch %d, res'd %d, pagesize %ld, minappaddr %p, maxappaddr %p,"
689 " act.cpumask %08lx, numcpus %ld, CPU type %ld, allocgran. %ld, CPU level %d, CPU rev %d\n",
690 si
->u
.s
.wProcessorArchitecture
, si
->u
.s
.wReserved
, si
->dwPageSize
,
691 si
->lpMinimumApplicationAddress
, si
->lpMaximumApplicationAddress
,
692 si
->dwActiveProcessorMask
, si
->dwNumberOfProcessors
, si
->dwProcessorType
,
693 si
->dwAllocationGranularity
, si
->wProcessorLevel
, si
->wProcessorRevision
);
695 create_registry_keys( &cachedsi
);
699 /***********************************************************************
700 * IsProcessorFeaturePresent [KERNEL32.@]
702 * Determine if the cpu supports a given feature.
705 * TRUE, If the processor supports feature,
708 BOOL WINAPI
IsProcessorFeaturePresent (
709 DWORD feature
/* [in] Feature number, (PF_ constants from "winnt.h") */)
712 GetSystemInfo (&si
); /* To ensure the information is loaded and cached */