summaryrefslogtreecommitdiff
path: root/src/vm/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/util.cpp')
-rw-r--r--src/vm/util.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 2cb3460122..2cf6f7f31c 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -1950,17 +1950,18 @@ size_t GetLogicalProcessorCacheSizeFromOS()
// Crack the information. Iterate through all the SLPI array entries for all processors in system.
// Will return the greatest of all the processor cache sizes or zero
-
- size_t last_cache_size = 0;
-
- for (DWORD i=0; i < nEntries; i++)
{
- if (pslpi[i].Relationship == RelationCache)
+ size_t last_cache_size = 0;
+
+ for (DWORD i=0; i < nEntries; i++)
{
- last_cache_size = max(last_cache_size, pslpi[i].Cache.Size);
- }
- }
- cache_size = last_cache_size;
+ if (pslpi[i].Relationship == RelationCache)
+ {
+ last_cache_size = max(last_cache_size, pslpi[i].Cache.Size);
+ }
+ }
+ cache_size = last_cache_size;
+ }
Exit:
if(pslpi)
@@ -1991,6 +1992,9 @@ DWORD GetLogicalCpuCountFromOS()
DWORD nEntries = 0;
+ DWORD prevcount = 0;
+ DWORD count = 1;
+
// Try to use GetLogicalProcessorInformation API and get a valid pointer to the SLPI array if successful. Returns NULL
// if API not present or on failure.
SYSTEM_LOGICAL_PROCESSOR_INFORMATION *pslpi = IsGLPISupported(&nEntries) ;
@@ -2001,9 +2005,6 @@ DWORD GetLogicalCpuCountFromOS()
goto lDone;
}
- DWORD prevcount = 0;
- DWORD count = 1;
-
for (DWORD j = 0; j < nEntries; j++)
{
if (pslpi[j].Relationship == RelationProcessorCore)
@@ -2069,16 +2070,9 @@ lDone:
#define CACHE_PARTITION_BITS 0x003FF000 // number of cache Physical Partitions is returned in EBX[21:12] (10 bits) using cpuid function 4
#define CACHE_LINESIZE_BITS 0x00000FFF // Linesize returned in EBX[11:0] (12 bits) using cpuid function 4
-#if defined(_TARGET_X86_)
- // these are defined in cgenx86.cpp
- extern DWORD getcpuid(DWORD arg1, unsigned char result[16]);
- extern DWORD getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16]);
-#elif defined(_TARGET_AMD64_)
- // these are defined in src\VM\AMD64\asmhelpers.asm
- extern "C" DWORD __stdcall getcpuid(DWORD arg1, unsigned char result[16]);
- extern "C" DWORD __stdcall getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16]);
-#endif
-
+// these are defined in src\VM\AMD64\asmhelpers.asm / cgenx86.cpp
+extern "C" DWORD __stdcall getcpuid(DWORD arg1, unsigned char result[16]);
+extern "C" DWORD __stdcall getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16]);
// The following function uses a deterministic mechanism for enumerating/calculating the details of the cache hierarychy at runtime
// by using deterministic cache parameter leafs on Prescott and higher processors.
@@ -2557,7 +2551,7 @@ extern BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem);
extern void ShutdownRuntimeWithoutExiting(int exitCode);
extern BOOL IsRuntimeStarted(DWORD *pdwStartupFlags);
-void * GetCLRFunction(LPCSTR FunctionName)
+void * __stdcall GetCLRFunction(LPCSTR FunctionName)
{
void* func = NULL;