[Kernel] Thread affinity cleanup
This commit is contained in:
@@ -224,17 +224,17 @@ DECLARE_XBOXKRNL_EXPORT1(KeSetCurrentStackPointers, kThreading, kImplemented);
|
||||
|
||||
dword_result_t KeSetAffinityThread(lpvoid_t thread_ptr, dword_t affinity,
|
||||
lpdword_t previous_affinity_ptr) {
|
||||
// Xbox 360 uses additional parameter (in comparation to NT equivalent)
|
||||
// which is used only for returning previous thread affinity. (Based on code
|
||||
// dissasembly)
|
||||
// The Xbox 360, according to disassembly of KeSetAffinityThread, unlike
|
||||
// Windows NT, stores the previous affinity via the pointer provided as an
|
||||
// argument, not in the return value - the return value is used for the
|
||||
// result.
|
||||
if (!affinity) {
|
||||
return X_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
auto thread = XObject::GetNativeObject<XThread>(kernel_state(), thread_ptr);
|
||||
if (thread) {
|
||||
if (previous_affinity_ptr) {
|
||||
*previous_affinity_ptr = 1 << thread->active_cpu();
|
||||
*previous_affinity_ptr = uint32_t(1) << thread->active_cpu();
|
||||
}
|
||||
thread->SetAffinity(affinity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user