diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-03-12 11:33:39 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-03-12 11:33:44 +0100 |
| commit | 666d051806dd7834b4436fbd5737d1ed669cd9b2 (patch) | |
| tree | 98af6d6da78b170355e9b844731e14d093d3e2ba /src/tools | |
| parent | 1e80316a7d6e83739691677ce1d21fabf9cd4158 (diff) | |
| download | box64-666d051806dd7834b4436fbd5737d1ed669cd9b2.tar.gz box64-666d051806dd7834b4436fbd5737d1ed669cd9b2.zip | |
Changed how cpu cores are reported in cpuid for large number (>64)
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/my_cpuid.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/tools/my_cpuid.c b/src/tools/my_cpuid.c index 76bfd2da..7cf04ffa 100644 --- a/src/tools/my_cpuid.c +++ b/src/tools/my_cpuid.c @@ -204,8 +204,15 @@ void my_cpuid(x64emu_t* emu, uint32_t tmp32u) { emu->regs[_AX].dword[1] = emu->regs[_DX].dword[1] = emu->regs[_CX].dword[1] = emu->regs[_BX].dword[1] = 0; int ncpu = getNCpu(); - if(ncpu>255) ncpu = 255; if(!ncpu) ncpu = 1; + int ncluster = 1; + while(ncpu>64) { + ncluster++; // do cluster of 64 cpus... + if(ncpu>=128) + ncpu-=64; + else + ncpu=64; + } static char branding[3*4*4+1] = ""; if(!branding[0]) { strcpy(branding, getBoxCpuName()); @@ -225,7 +232,7 @@ void my_cpuid(x64emu_t* emu, uint32_t tmp32u) break; case 0x1: R_EAX = 0x00000601; // family and all - R_EBX = 0 | (8<<0x8) | (/*ncpu*/1<<16); // Brand index, CLFlush (8), Max APIC ID (16-23), Local APIC ID (24-31) + R_EBX = 0 | (8<<0x8) | (ncluster<<16); // Brand index, CLFlush (8), Max APIC ID (16-23), Local APIC ID (24-31) /*{ int cpu = sched_getcpu(); if(cpu<0) cpu=0; |