mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Last patch was incomplete, apologies. SVN @ 5AM = bad idea.
- Do not report that ROS is running on 0 active processors, that's a bad idea. - Actually check the affinity mask set by NtSetInformationThread - Fix the check in KeSetAffinityThread - Give a valid affinity to the system thread (corresponding to the active cpu affinity set). This removes all bugchecks from the kernel32 thread winetest. svn path=/trunk/; revision=17235
This commit is contained in:
parent
6fd4c50fd3
commit
61ffdb3516
5 changed files with 29 additions and 4 deletions
|
@ -226,6 +226,12 @@ LONG
|
|||
STDCALL
|
||||
KeQueryBasePriorityThread(IN PKTHREAD Thread);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
KiSetPriorityThread(PKTHREAD Thread,
|
||||
KPRIORITY Priority,
|
||||
PBOOLEAN Released);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
KeStackAttachProcess (
|
||||
|
|
|
@ -1299,7 +1299,12 @@ KeSetAffinityThread(PKTHREAD Thread,
|
|||
|
||||
DPRINT("KeSetAffinityThread(Thread %x, Affinity %x)\n", Thread, Affinity);
|
||||
|
||||
ASSERT(Affinity & ((1 << KeNumberProcessors) - 1));
|
||||
/* Verify correct affinity */
|
||||
if ((Affinity & Thread->ApcStatePointer[0]->Process->Affinity) !=
|
||||
Affinity || !Affinity)
|
||||
{
|
||||
KEBUGCHECK(INVALID_AFFINITY_SET);
|
||||
}
|
||||
|
||||
OldIrql = KeAcquireDispatcherDatabaseLock();
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(6, 0);
|
|||
EXPORTED ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
|
||||
EXPORTED ULONG NtGlobalFlag = 0;
|
||||
EXPORTED CHAR KeNumberProcessors;
|
||||
EXPORTED KAFFINITY KeActiveProcessors;
|
||||
EXPORTED KAFFINITY KeActiveProcessors = 1;
|
||||
EXPORTED LOADER_PARAMETER_BLOCK KeLoaderBlock;
|
||||
EXPORTED ULONG KeDcacheFlushCount = 0;
|
||||
EXPORTED ULONG KeIcacheFlushCount = 0;
|
||||
|
|
|
@ -213,7 +213,7 @@ PsInitProcessManagment(VOID)
|
|||
|
||||
/* System threads may run on any processor. */
|
||||
RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
|
||||
PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF;
|
||||
PsInitialSystemProcess->Pcb.Affinity = KeActiveProcessors;
|
||||
PsInitialSystemProcess->Pcb.IopmOffset = 0xffff;
|
||||
PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL;
|
||||
PsInitialSystemProcess->Pcb.QuantumReset = 6;
|
||||
|
|
|
@ -1194,6 +1194,8 @@ NtSetInformationThread (IN HANDLE ThreadHandle,
|
|||
SetInformationData[ThreadInformationClass].Size);
|
||||
}
|
||||
|
||||
/* FIXME: This is REALLY wrong. Some types don't need THREAD_SET_INFORMATION */
|
||||
/* FIXME: We should also check for certain things before doing the reference */
|
||||
Status = ObReferenceObjectByHandle (ThreadHandle,
|
||||
THREAD_SET_INFORMATION,
|
||||
PsThreadType,
|
||||
|
@ -1218,7 +1220,19 @@ NtSetInformationThread (IN HANDLE ThreadHandle,
|
|||
break;
|
||||
|
||||
case ThreadAffinityMask:
|
||||
Status = KeSetAffinityThread(&Thread->Tcb, u.Affinity);
|
||||
|
||||
/* Check if this is valid */
|
||||
DPRINT1("%lx, %lx\n", Thread->ThreadsProcess->Pcb.Affinity, u.Affinity);
|
||||
if ((Thread->ThreadsProcess->Pcb.Affinity & u.Affinity) !=
|
||||
u.Affinity)
|
||||
{
|
||||
DPRINT1("Wrong affinity given\n");
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = KeSetAffinityThread(&Thread->Tcb, u.Affinity);
|
||||
}
|
||||
break;
|
||||
|
||||
case ThreadImpersonationToken:
|
||||
|
|
Loading…
Reference in a new issue