From 666d051806dd7834b4436fbd5737d1ed669cd9b2 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 12 Mar 2024 11:33:39 +0100 Subject: Changed how cpu cores are reported in cpuid for large number (>64) --- src/tools/my_cpuid.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit 1.4.1