diff options
| -rw-r--r-- | src/core.c | 4 | ||||
| -rw-r--r-- | src/include/my_cpuid.h | 2 | ||||
| -rw-r--r-- | src/os/my_cpuid_linux.c | 12 | ||||
| -rw-r--r-- | src/os/my_cpuid_wine.c | 11 | ||||
| -rw-r--r-- | src/tools/env.c | 6 | ||||
| -rw-r--r-- | system/box64.box64rc | 5 |
6 files changed, 36 insertions, 4 deletions
diff --git a/src/core.c b/src/core.c index 5e164c7a..4404f6bf 100644 --- a/src/core.c +++ b/src/core.c @@ -219,7 +219,7 @@ void my_child_fork() } const char* getCpuName(); -int getNCpu(); +int getNCpuUnmasked(); #ifdef DYNAREC void GatherDynarecExtensions() @@ -445,7 +445,7 @@ static void displayMiscInfo() #endif // grab ncpu and cpu name - int ncpu = getNCpu(); + int ncpu = getNCpuUnmasked(); const char* cpuname = getCpuName(); printf_log(LOG_INFO, "Running on %s with %d core%s, pagesize: %zd\n", cpuname, ncpu, ncpu > 1 ? "s" : "", box64_pagesize); diff --git a/src/include/my_cpuid.h b/src/include/my_cpuid.h index 985e9cb6..3904517c 100644 --- a/src/include/my_cpuid.h +++ b/src/include/my_cpuid.h @@ -8,5 +8,7 @@ uint32_t helper_getcpu(x64emu_t* emu); // get the numa/cpu id actually running uint32_t get_random32(); uint64_t get_random64(); int getNCpu(); +int getNCpuUnmasked(); +int canNCpuBeChanged(); const char* getBoxCpuName(); #endif //__MY_CPUID_H__ diff --git a/src/os/my_cpuid_linux.c b/src/os/my_cpuid_linux.c index c783a44a..5979975a 100644 --- a/src/os/my_cpuid_linux.c +++ b/src/os/my_cpuid_linux.c @@ -76,6 +76,7 @@ int get_cpuMhz() } static int nCPU = 0; static double bogoMips = 100.; +static int read_ncpu = 0; void grabNCpu() { nCPU = 1; // default number of CPU to 1 @@ -107,10 +108,21 @@ int getNCpu() { if(!nCPU) grabNCpu(); + read_ncpu = 1; if(BOX64ENV(maxcpu) && nCPU>BOX64ENV(maxcpu)) return BOX64ENV(maxcpu); return nCPU; } +int getNCpuUnmasked() +{ + if(!nCPU) + grabNCpu(); + return nCPU; +} +int canNCpuBeChanged() +{ + return read_ncpu?0:1; +} double getBogoMips() { diff --git a/src/os/my_cpuid_wine.c b/src/os/my_cpuid_wine.c index 85e8e8a8..d5774bc1 100644 --- a/src/os/my_cpuid_wine.c +++ b/src/os/my_cpuid_wine.c @@ -8,6 +8,7 @@ NTSYSAPI ULONG WINAPI NtGetTickCount(VOID); NTSYSAPI ULONG NTAPI RtlRandom(ULONG *seed); static int nCPU = 0; +static int read_ncpu = 0; void grabNCpu() { SYSTEM_INFO sysinfo; @@ -22,6 +23,16 @@ int getNCpu() return BOX64ENV(maxcpu); return nCPU; } +int getNCpuUnmasked() +{ + if(!nCPU) + grabNCpu(); + return nCPU; +} +int canNCpuBeChanged() +{ + return read_ncpu?0:1; +} const char* getBoxCpuName() { diff --git a/src/tools/env.c b/src/tools/env.c index ed1bf326..3cd12818 100644 --- a/src/tools/env.c +++ b/src/tools/env.c @@ -121,6 +121,7 @@ static void parseRange(const char* s, uintptr_t* start, uintptr_t* end) } void AddNewLibs(const char* list); +int canNCpuBeChanged(); static void applyCustomRules() { @@ -196,8 +197,9 @@ static void applyCustomRules() #endif } - if (box64env.maxcpu == 0 || (!box64_wine && box64env.new_maxcpu < box64env.maxcpu)) { - box64env.maxcpu = box64env.new_maxcpu; + if (box64env.maxcpu == 0 || (box64env.new_maxcpu < box64env.maxcpu)) { + if(canNCpuBeChanged()) + box64env.maxcpu = box64env.new_maxcpu; } #ifndef _WIN32 diff --git a/system/box64.box64rc b/system/box64.box64rc index bd5c2c00..f70dd187 100644 --- a/system/box64.box64rc +++ b/system/box64.box64rc @@ -161,6 +161,11 @@ BOX64_EMULATED_LIBS=libSDL2-2.0.so.0 BOX64_CRASHHANDLER=1 BOX64_DYNAREC_STRONGMEM=1 +[DXHRDC.exe] +BOX64_DYNAREC_BIGBLOCK=3 +BOX64_DYNAREC_CALLRET=1 +BOX64_MAXCPU=16 + [EtG.x86_64] BOX64_MAXCPU=4 #it will crash with too many cpu, 4 is enough anyway |