@@ -22,7 +22,7 @@ const tchar* GetProcessorVendorId();
22
22
23
23
static bool cpuid(uint32 function, uint32& out_eax, uint32& out_ebx, uint32& out_ecx, uint32& out_edx)
24
24
{
25
- #if defined (__arm__) || defined (__aarch64__) || defined( _X360 )
25
+ #if defined(__arm__) || defined(__aarch64__) || defined(__e2k__) || defined(_X360 )
26
26
return false;
27
27
#elif defined(GNUC)
28
28
@@ -337,6 +337,8 @@ const tchar* GetProcessorVendorId()
337
337
return "PPC";
338
338
#elif defined ( __arm__ )
339
339
return "ARM";
340
+ #elif defined (__e2k__)
341
+ return "MCST";
340
342
#else
341
343
uint32 unused, VendorIDRegisters[3];
342
344
@@ -372,10 +374,12 @@ const tchar* GetProcessorArchName()
372
374
return "amd64";
373
375
#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86)
374
376
return "i386";
375
- #elif defined __aarch64__
376
- return "aarch64";
377
- #elif defined __arm__ || defined _M_ARM
378
- return "arm";
377
+ #elif defined(__aarch64__)
378
+ return "aarch64";
379
+ #elif defined(__arm__) || defined(_M_ARM)
380
+ return "arm";
381
+ #elif defined(__e2k__)
382
+ return "e2k";
379
383
#else
380
384
#error "Unknown architecture"
381
385
#endif
@@ -528,6 +532,13 @@ const CPUInformation* GetCPUInformation()
528
532
pi.m_nPhysicalProcessors = 3;
529
533
pi.m_nLogicalProcessors = 6;
530
534
#elif defined(_LINUX)
535
+ #if defined(__e2k__) // MCST Elbrus 2000
536
+ // e2k CPU don't have "core id" and "physical id" in "/proc/cpuinfo" (but have "processor")
537
+ // and don't have Hyper-Threading (HT) technology
538
+ // used sysconf() to count CPU cores
539
+ pi.m_nLogicalProcessors = sysconf( _SC_NPROCESSORS_CONF ); // _SC_NPROCESSORS_ONLN may not be reliable on ARM/Android
540
+ pi.m_nPhysicalProcessors = pi.m_nLogicalProcessors; // hack for CPU without Hyper-Threading (HT) technology
541
+ #else
531
542
// TODO: poll /dev/cpuinfo when we have some benefits from multithreading
532
543
FILE *fpCpuInfo = fopen( "/proc/cpuinfo", "r" );
533
544
if ( fpCpuInfo )
@@ -584,6 +595,7 @@ const CPUInformation* GetCPUInformation()
584
595
pi.m_nLogicalProcessors = 1;
585
596
Assert( !"couldn't read cpu information from /proc/cpuinfo" );
586
597
}
598
+ #endif // if e2k
587
599
#elif defined(OSX) || defined(PLATFORM_BSD)
588
600
int mib[2], num_cpu = 1;
589
601
size_t len;
0 commit comments