From 4e266cf9fddaef1df4b1eb8e78202f85af48467d Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Tue, 11 Jul 2023 12:41:26 +0100 Subject: [PATCH] FHU: Fix WIN32 getcpu implementation Both parameters to getcpu are nullable and FEX relies upon this for CPUID. --- FEXHeaderUtils/FEXHeaderUtils/Syscalls.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/FEXHeaderUtils/FEXHeaderUtils/Syscalls.h b/FEXHeaderUtils/FEXHeaderUtils/Syscalls.h index 9d8dec6c3..e47032188 100644 --- a/FEXHeaderUtils/FEXHeaderUtils/Syscalls.h +++ b/FEXHeaderUtils/FEXHeaderUtils/Syscalls.h @@ -98,8 +98,12 @@ inline int32_t pidfd_open(pid_t pid, unsigned int flags) { #else inline int32_t getcpu(uint32_t *cpu, uint32_t *node) { - *cpu = GetCurrentProcessorNumber(); - *node = 0; + if (cpu) { + *cpu = GetCurrentProcessorNumber(); + } + if (node) { + *node = 0; + } return 0; }