Re: [PATCH v5 0/1] MR824: ntoskrnl: Implement KeGetCurrentProcessorNumberEx
Jinoh Kang (@iamahuman) commented about dlls/ntoskrnl.exe/ntoskrnl.c:
+/*********************************************************************** + * KeGetCurrentProcessorNumberEx (NTOSKRNL.EXE.@) + */ +ULONG WINAPI KeGetCurrentProcessorNumberEx(PPROCESSOR_NUMBER process_number) +{ + FIXME("%p semi-stub\n", process_number); + + if (process_number) + { + process_number->Group = 0; + process_number->Reserved = 0; + process_number->Number = NtGetCurrentProcessorNumber(); + } + + return NtGetCurrentProcessorNumber();
You should only call `NtGetCurrentProcessorNumber()` once. Otherwise, the processor number can change if the thread is preempted and then re-scheduled to another processor. This leads to inconsistent values between the return value and the `process_number->Number` output. In general, you should treat `NtGetCurrentProcessorNumber()` as being volatile. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/824#note_8781
participants (1)
-
Jinoh Kang (@iamahuman)