@@ -22,7 +22,7 @@ const tchar* GetProcessorVendorId();
2222
2323static bool cpuid (uint32 function, uint32& out_eax, uint32& out_ebx, uint32& out_ecx, uint32& out_edx)
2424{
25- #if defined (__arm__) || defined (__aarch64__) || defined( _X360 )
25+ #if defined(__arm__) || defined(__aarch64__) || defined(__e2k__) || defined(_X360 )
2626 return false ;
2727#elif defined(GNUC)
2828
@@ -337,6 +337,8 @@ const tchar* GetProcessorVendorId()
337337 return " PPC" ;
338338#elif defined ( __arm__ )
339339 return " ARM" ;
340+ #elif defined (__e2k__)
341+ return " MCST" ;
340342#else
341343 uint32 unused, VendorIDRegisters[3 ];
342344
@@ -372,10 +374,12 @@ const tchar* GetProcessorArchName()
372374 return " amd64" ;
373375#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86)
374376 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" ;
379383#else
380384#error "Unknown architecture"
381385#endif
@@ -528,6 +532,13 @@ const CPUInformation* GetCPUInformation()
528532 pi.m_nPhysicalProcessors = 3 ;
529533 pi.m_nLogicalProcessors = 6 ;
530534#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
531542 // TODO: poll /dev/cpuinfo when we have some benefits from multithreading
532543 FILE *fpCpuInfo = fopen ( " /proc/cpuinfo" , " r" );
533544 if ( fpCpuInfo )
@@ -584,6 +595,7 @@ const CPUInformation* GetCPUInformation()
584595 pi.m_nLogicalProcessors = 1 ;
585596 Assert ( !" couldn't read cpu information from /proc/cpuinfo" );
586597 }
598+ #endif // if e2k
587599#elif defined(OSX) || defined(PLATFORM_BSD)
588600 int mib[2 ], num_cpu = 1 ;
589601 size_t len;
0 commit comments