Advertisement
Guest User

Untitled

a guest
Dec 12th, 2020
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. __int64 sub_1429CF280()
  2. {
  3.   int cpuFamily; // ecx
  4.   __int64 result; // rax
  5.   int Str1; // [rsp+20h] [rbp-18h]
  6.   int v13; // [rsp+24h] [rbp-14h]
  7.   int v14; // [rsp+28h] [rbp-10h]
  8.   char v15; // [rsp+2Ch] [rbp-Ch]
  9.   unsigned int coreCount; // [rsp+40h] [rbp+8h]
  10.   unsigned int threadCount; // [rsp+48h] [rbp+10h]
  11.  
  12.   GeThreadAndCoreCount(&threadCount, &coreCount);
  13.   v15 = 0;
  14.   _RAX = 0i64;
  15.   __asm { cpuid }
  16.   v13 = _RDX;
  17.   v14 = _RCX;
  18.   Str1 = _RBX;
  19.   if ( (unsigned int)strcmp(&Str1, "AuthenticAMD") )
  20.     return coreCount;
  21.   _RAX = 1i64;
  22.   __asm { cpuid }
  23.   cpuFamily = ((signed int)_RAX >> 8) & 0xF;
  24.   if ( cpuFamily == 15 )                        // CPUID says is family is 15 then family = 15 + extended family
  25.     cpuFamily = (unsigned __int8)((signed int)_RAX >> 20) + 15;
  26.   result = threadCount;
  27.   if ( cpuFamily == 21 )                        // intel cpu family 21 only uses cores and not threads for some reason
  28.     result = coreCount;
  29.   return result;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement