4 * Copyright 1995 Morten Welinder
5 * Copyright 1997 Marcus Meissner
13 VOID WINAPI
GetSystemInfo(LPSYSTEM_INFO si
)
16 static SYSTEM_INFO cachedsi
;
19 memcpy(si
,&cachedsi
,sizeof(*si
));
23 /* choose sensible defaults ...
24 * FIXME: perhaps overrideable with precompiler flags?
26 cachedsi
.u
.x
.wProcessorArchitecture
= PROCESSOR_ARCHITECTURE_INTEL
;
27 cachedsi
.dwPageSize
= 4096;
29 /* FIXME: better values for the two entries below... */
30 cachedsi
.lpMinimumApplicationAddress
= (void *)0x40000000;
31 cachedsi
.lpMaximumApplicationAddress
= (void *)0x80000000;
32 cachedsi
.dwActiveProcessorMask
= 1;
33 cachedsi
.dwNumberOfProcessors
= 1;
34 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
35 cachedsi
.dwAllocationGranularity
= 0x10000;
36 cachedsi
.wProcessorLevel
= 3; /* 386 */
37 cachedsi
.wProcessorRevision
= 0;
39 cache
= 1; /* even if there is no more info, we now have a cacheentry */
40 memcpy(si
,&cachedsi
,sizeof(*si
));
44 char line
[200],info
[200],value
[200],junk
[200];
45 FILE *f
= fopen ("/proc/cpuinfo", "r");
49 while (fgets(line
,200,f
)!=NULL
) {
50 if (sscanf(line
,"%s%[ \t:]%s",info
,junk
,value
)!=3)
52 if (!lstrncmpi32A(line
, "cpu",3)) {
53 if ( isdigit (value
[0]) && value
[1] == '8' &&
54 value
[2] == '6' && value
[3] == 0
56 switch (value
[0] - '0') {
58 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_386
;
59 cachedsi
.wProcessorLevel
= 3;
62 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_486
;
63 cachedsi
.wProcessorLevel
= 4;
66 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
67 cachedsi
.wProcessorLevel
= 5;
69 case 6: /* FIXME does the PPro have a special type? */
70 cachedsi
.dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
71 cachedsi
.wProcessorLevel
= 5;
78 if (!lstrncmpi32A(info
,"processor",9)) {
79 /* processor number counts up...*/
82 if (sscanf(value
,"%d",&x
))
83 if (x
+1>cachedsi
.dwNumberOfProcessors
)
84 cachedsi
.dwNumberOfProcessors
=x
+1;
86 if (!lstrncmpi32A(info
,"stepping",8)) {
89 if (sscanf(value
,"%d",&x
))
90 cachedsi
.wProcessorRevision
= x
;
95 memcpy(si
,&cachedsi
,sizeof(*si
));
98 /* FIXME: how do we do this on other systems? */