Ignore:
Timestamp:
Nov 23, 1999, 9:01:18 PM (26 years ago)
Author:
sandervl
Message:

GetSystemInfo supports SMP machines now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/cpu.cpp

    r1815 r1820  
    1 /* $Id: cpu.cpp,v 1.1 1999-11-23 19:31:35 sandervl Exp $ */
     1/* $Id: cpu.cpp,v 1.2 1999-11-23 20:01:17 sandervl Exp $ */
    22/*
    33 * Odin win32 CPU apis
     
    2525
    2626static BYTE PF[64] = {0,};
    27 
    28 //******************************************************************************
    29 //******************************************************************************
    30 void InitSystemInfo()
     27static nrCPUs = 1;
     28//******************************************************************************
     29//******************************************************************************
     30void InitSystemInfo(int nrcpus)
    3131{
    3232  SYSTEM_INFO si;
    3333
     34   nrCPUs = nrcpus;
    3435   GetSystemInfo(&si);
    3536}
     
    5859 static SYSTEM_INFO cachedsi;
    5960 HKEY   xhkey=0,hkey;
     61 HKEY   fpukey=0, xhfpukey;
    6062 char buf[20];
    6163 DWORD features, signature;
     
    8385        cachedsi.lpMaximumApplicationAddress    = (void *)0x7FFFFFFF;
    8486        cachedsi.dwActiveProcessorMask          = 1;
    85         cachedsi.dwNumberOfProcessors           = 1;
     87        cachedsi.dwNumberOfProcessors           = nrCPUs;
    8688        cachedsi.dwProcessorType                = PROCESSOR_INTEL_386;
    8789        cachedsi.dwAllocationGranularity        = 0x10000;
     
    154156                //Create FPU key if one is present
    155157                if (features & CPUID_FPU_PRESENT) {
    156                  HKEY fpukey;
    157                         if (RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor",&fpukey)!=ERROR_SUCCESS) {
    158                                 dprintf(("Unable to register FPU information\n"));
     158                        if (i == 0) {
     159                                if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor",&fpukey)!=ERROR_SUCCESS)
     160                                        dprintf(("Unable to register FPU information\n"));
    159161                        }
    160                         else    RegCloseKey(fpukey);
     162                        // Create a new processor subkey
     163                        if(fpukey) {
     164                                sprintf(buf,"%d",i);
     165                                RegCreateKeyA(fpukey,buf,&xhfpukey);
     166                        }
    161167                }
    162168       
     
    169175        if (hkey)
    170176                RegCloseKey(hkey);
     177        if (xhfpukey)
     178                RegCloseKey(xhfpukey);
     179        if (fpukey)
     180                RegCloseKey(fpukey);
     181
    171182}
    172183
Note: See TracChangeset for help on using the changeset viewer.