mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Further SMP initialization work (now boots all processors on SMP bochs)
Preparation for per-processor GDT svn path=/trunk/; revision=1805
This commit is contained in:
parent
add5e2d89f
commit
85f85e8462
9 changed files with 150 additions and 124 deletions
|
@ -16,4 +16,4 @@ DBG := 1
|
|||
#
|
||||
# Whether to compile a multiprocessor or single processor version
|
||||
#
|
||||
MP := 0
|
||||
MP := 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mp.c,v 1.8 2001/04/16 02:02:04 dwelch Exp $
|
||||
/* $Id: mp.c,v 1.9 2001/04/16 16:29:01 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1362,7 +1362,7 @@ static VOID SetInterruptGate(
|
|||
{
|
||||
IDT_DESCRIPTOR *idt;
|
||||
|
||||
idt = (IDT_DESCRIPTOR*)((ULONG)CURRENT_KPCR->IDT + index * sizeof(IDT_DESCRIPTOR));
|
||||
idt = (IDT_DESCRIPTOR*)((ULONG)KeGetCurrentKPCR()->IDT + index * sizeof(IDT_DESCRIPTOR));
|
||||
idt->a = (((ULONG)address)&0xffff) + (KERNEL_CS << 16);
|
||||
idt->b = 0x8f00 + (((ULONG)address)&0xffff0000);
|
||||
}
|
||||
|
@ -2017,82 +2017,87 @@ HaliReadMPConfigTable(
|
|||
ULONG Count;
|
||||
|
||||
if (Table->Signature != MPC_SIGNATURE)
|
||||
{
|
||||
PUCHAR pc = (PUCHAR)&Table->Signature;
|
||||
|
||||
DbgPrint("Bad MP configuration block signature: %c%c%c%c/%x/%x\n", pc[0],
|
||||
pc[1], pc[2], pc[3], MPC_SIGNATURE, (ULONG)Table->Signature);
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
{
|
||||
PUCHAR pc = (PUCHAR)&Table->Signature;
|
||||
|
||||
DbgPrint("Bad MP configuration block signature: %c%c%c%c/%x/%x\n",
|
||||
pc[0], pc[1], pc[2], pc[3], MPC_SIGNATURE,
|
||||
(ULONG)Table->Signature);
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MPChecksum((PUCHAR)Table, Table->Length))
|
||||
{
|
||||
DbgPrint("Bad MP configuration block checksum\n");
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
{
|
||||
DbgPrint("Bad MP configuration block checksum\n");
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Table->Specification < 0x04)
|
||||
{
|
||||
DbgPrint("Bad MP configuration table version (%d)\n",
|
||||
Table->Specification);
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
if (Table->Specification < 0x04)
|
||||
{
|
||||
DbgPrint("Bad MP configuration table version (%d)\n",
|
||||
Table->Specification);
|
||||
KeBugCheck(0);
|
||||
return;
|
||||
}
|
||||
|
||||
APICBase = (PULONG)Table->LocalAPICAddress;
|
||||
if (APICBase != (PULONG)APIC_DEFAULT_BASE)
|
||||
{
|
||||
DbgPrint("APIC base address is at 0x%X. " \
|
||||
"I cannot handle non-standard adresses\n", APICBase);
|
||||
KeBugCheck(0);
|
||||
}
|
||||
{
|
||||
DbgPrint("APIC base address is at 0x%X. " \
|
||||
"I cannot handle non-standard adresses\n", APICBase);
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
Entry = (PUCHAR)(Table + sizeof(MP_CONFIGURATION_TABLE));
|
||||
Entry = (PUCHAR)((PVOID)Table + sizeof(MP_CONFIGURATION_TABLE));
|
||||
Count = 0;
|
||||
while (Count < Table->Length)
|
||||
while (Count < (Table->Length - sizeof(MP_CONFIGURATION_TABLE)))
|
||||
{
|
||||
/* Switch on type */
|
||||
switch (*Entry)
|
||||
{
|
||||
case MPCTE_PROCESSOR:
|
||||
DbgPrint("Scanning entry %x/%x Count %x\n", Entry, *Entry, Count);
|
||||
/* Switch on type */
|
||||
switch (*Entry)
|
||||
{
|
||||
case MPCTE_PROCESSOR:
|
||||
{
|
||||
HaliMPProcessorInfo((PMP_CONFIGURATION_PROCESSOR)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_PROCESSOR);
|
||||
Count += sizeof(MP_CONFIGURATION_PROCESSOR);
|
||||
break;
|
||||
}
|
||||
case MPCTE_BUS:
|
||||
{
|
||||
HaliMPBusInfo((PMP_CONFIGURATION_BUS)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_BUS);
|
||||
Count += sizeof(MP_CONFIGURATION_BUS);
|
||||
break;
|
||||
}
|
||||
case MPCTE_IOAPIC:
|
||||
{
|
||||
HaliMPIOApicInfo((PMP_CONFIGURATION_IOAPIC)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_IOAPIC);
|
||||
Count += sizeof(MP_CONFIGURATION_IOAPIC);
|
||||
break;
|
||||
}
|
||||
case MPCTE_INTSRC:
|
||||
{
|
||||
HaliMPIntSrcInfo((PMP_CONFIGURATION_INTSRC)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_INTSRC);
|
||||
Count += sizeof(MP_CONFIGURATION_INTSRC);
|
||||
break;
|
||||
}
|
||||
case MPCTE_LINTSRC:
|
||||
{
|
||||
HaliMPIntLocalInfo((PMP_CONFIGURATION_INTLOCAL)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_INTLOCAL);
|
||||
Count += sizeof(MP_CONFIGURATION_INTLOCAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
HaliMPProcessorInfo((PMP_CONFIGURATION_PROCESSOR)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_PROCESSOR);
|
||||
Count += sizeof(MP_CONFIGURATION_PROCESSOR);
|
||||
break;
|
||||
}
|
||||
case MPCTE_BUS:
|
||||
{
|
||||
HaliMPBusInfo((PMP_CONFIGURATION_BUS)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_BUS);
|
||||
Count += sizeof(MP_CONFIGURATION_BUS);
|
||||
break;
|
||||
}
|
||||
case MPCTE_IOAPIC:
|
||||
{
|
||||
HaliMPIOApicInfo((PMP_CONFIGURATION_IOAPIC)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_IOAPIC);
|
||||
Count += sizeof(MP_CONFIGURATION_IOAPIC);
|
||||
break;
|
||||
}
|
||||
case MPCTE_INTSRC:
|
||||
{
|
||||
HaliMPIntSrcInfo((PMP_CONFIGURATION_INTSRC)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_INTSRC);
|
||||
Count += sizeof(MP_CONFIGURATION_INTSRC);
|
||||
break;
|
||||
}
|
||||
case MPCTE_LINTSRC:
|
||||
{
|
||||
HaliMPIntLocalInfo((PMP_CONFIGURATION_INTLOCAL)Entry);
|
||||
Entry += sizeof(MP_CONFIGURATION_INTLOCAL);
|
||||
Count += sizeof(MP_CONFIGURATION_INTLOCAL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DbgPrint("Unknown entry in MPC table\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -239,20 +239,20 @@ typedef struct __attribute__((packed)) _MP_FLOATING_POINTER
|
|||
|
||||
typedef struct __attribute__((packed)) _MP_CONFIGURATION_TABLE
|
||||
{
|
||||
ULONG Signature; /* PCMP */
|
||||
USHORT Length; /* Size of configuration table */
|
||||
CHAR Specification; /* Specification Revision */
|
||||
CHAR Checksum; /* Checksum */
|
||||
CHAR Oem[8]; /* OEM ID */
|
||||
CHAR ProductId[12]; /* Product ID */
|
||||
ULONG OemTable; /* 0 if not present */
|
||||
USHORT OemTableSize; /* 0 if not present */
|
||||
USHORT EntryCount; /* Number of entries */
|
||||
ULONG LocalAPICAddress; /* Local APIC address */
|
||||
ULONG Signature; /* PCMP */
|
||||
USHORT Length; /* Size of configuration table */
|
||||
CHAR Specification; /* Specification Revision */
|
||||
CHAR Checksum; /* Checksum */
|
||||
CHAR Oem[8]; /* OEM ID */
|
||||
CHAR ProductId[12]; /* Product ID */
|
||||
ULONG OemTable; /* 0 if not present */
|
||||
USHORT OemTableSize; /* 0 if not present */
|
||||
USHORT EntryCount; /* Number of entries */
|
||||
ULONG LocalAPICAddress; /* Local APIC address */
|
||||
USHORT ExtTableLength; /* Extended Table Length */
|
||||
UCHAR ExtTableChecksum; /* Extended Table Checksum */
|
||||
UCHAR Reserved; /* Reserved */
|
||||
} MP_CONFIGURATION_TABLE, *PMP_CONFIGURATION_TABLE;
|
||||
UCHAR Reserved; /* Reserved */
|
||||
} __attribute__((packed)) MP_CONFIGURATION_TABLE, *PMP_CONFIGURATION_TABLE;
|
||||
|
||||
/* MP Configuration Table Entries */
|
||||
#define MPCTE_PROCESSOR 0 /* One entry per processor */
|
||||
|
@ -264,14 +264,15 @@ typedef struct __attribute__((packed)) _MP_CONFIGURATION_TABLE
|
|||
|
||||
typedef struct __attribute__((packed)) _MP_CONFIGURATION_PROCESSOR
|
||||
{
|
||||
UCHAR Type; /* 0 */
|
||||
UCHAR ApicId; /* Local APIC ID for the processor */
|
||||
UCHAR ApicVersion; /* Local APIC version */
|
||||
UCHAR CpuFlags; /* CPU flags */
|
||||
ULONG CpuSignature; /* CPU signature */
|
||||
UCHAR Type; /* 0 */
|
||||
UCHAR ApicId; /* Local APIC ID for the processor */
|
||||
UCHAR ApicVersion; /* Local APIC version */
|
||||
UCHAR CpuFlags; /* CPU flags */
|
||||
ULONG CpuSignature; /* CPU signature */
|
||||
ULONG FeatureFlags; /* CPUID feature value */
|
||||
ULONG Reserved[2]; /* Reserved (0) */
|
||||
} MP_CONFIGURATION_PROCESSOR, *PMP_CONFIGURATION_PROCESSOR;
|
||||
ULONG Reserved[2]; /* Reserved (0) */
|
||||
} __attribute__((packed)) MP_CONFIGURATION_PROCESSOR,
|
||||
*PMP_CONFIGURATION_PROCESSOR;
|
||||
|
||||
#define CPU_FLAG_ENABLED 1 /* Processor is available */
|
||||
#define CPU_FLAG_BSP 2 /* Processor is the bootstrap processor */
|
||||
|
@ -286,7 +287,7 @@ typedef struct __attribute__((packed)) _MP_CONFIGURATION_BUS
|
|||
UCHAR Type; /* 1 */
|
||||
UCHAR BusId; /* Bus ID */
|
||||
UCHAR BusType[6]; /* Bus type */
|
||||
} MP_CONFIGURATION_BUS, *PMP_CONFIGURATION_BUS;
|
||||
} __attribute__((packed)) MP_CONFIGURATION_BUS, *PMP_CONFIGURATION_BUS;
|
||||
|
||||
#define MAX_BUS 32
|
||||
|
||||
|
@ -322,7 +323,7 @@ typedef struct __attribute__((packed)) _MP_CONFIGURATION_IOAPIC
|
|||
UCHAR ApicVersion; /* I/O APIC version */
|
||||
UCHAR ApicFlags; /* I/O APIC flags */
|
||||
ULONG ApicAddress; /* I/O APIC base address */
|
||||
} MP_CONFIGURATION_IOAPIC, *PMP_CONFIGURATION_IOAPIC;
|
||||
} __attribute__((packed)) MP_CONFIGURATION_IOAPIC, *PMP_CONFIGURATION_IOAPIC;
|
||||
|
||||
#define MAX_IOAPIC 2
|
||||
|
||||
|
@ -338,7 +339,7 @@ typedef struct __attribute__((packed)) _MP_CONFIGURATION_INTSRC
|
|||
UCHAR SrcBusIrq; /* Source bus interrupt */
|
||||
UCHAR DstApicId; /* Destination APIC ID */
|
||||
UCHAR DstApicInt; /* Destination interrupt */
|
||||
} MP_CONFIGURATION_INTSRC, *PMP_CONFIGURATION_INTSRC;
|
||||
} __attribute__((packed)) MP_CONFIGURATION_INTSRC, *PMP_CONFIGURATION_INTSRC;
|
||||
|
||||
#define MAX_IRQ_SOURCE 128
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ static inline PKPCR KeGetCurrentKPCR(VOID)
|
|||
return((PKPCR)value);
|
||||
}
|
||||
|
||||
#define CURRENT_KPCR KeGetCurrentKPCR()
|
||||
|
||||
#define KeGetCurrentProcessorNumber (KeGetCurrentKPCR()->ProcessorNumber)
|
||||
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
|
||||
|
||||
extern HANDLE SystemProcessHandle;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: irq.c,v 1.10 2001/04/16 02:02:05 dwelch Exp $
|
||||
/* $Id: irq.c,v 1.11 2001/04/16 16:29:02 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -100,14 +100,14 @@ B16(7) B16(8) B16(9) B16(A)
|
|||
B16(B) B16(C) B16(D) B16(E)
|
||||
B16(F)
|
||||
|
||||
#undef B;
|
||||
#undef B16;
|
||||
#undef B
|
||||
#undef B16
|
||||
|
||||
|
||||
/* Interrupt handler list */
|
||||
|
||||
#define L(x,y) \
|
||||
(ULONG)&##INT_NAME2(x##y)
|
||||
(ULONG)& INT_NAME2(x##y)
|
||||
|
||||
#define L16(x) \
|
||||
L(x,0), L(x,1), L(x,2), L(x,3), \
|
||||
|
@ -122,8 +122,8 @@ static ULONG irq_handler[NR_IRQS] = {
|
|||
L16(F)
|
||||
};
|
||||
|
||||
#undef L;
|
||||
#undef L16;
|
||||
#undef L
|
||||
#undef L16
|
||||
|
||||
#else /* MP */
|
||||
|
||||
|
|
|
@ -183,14 +183,14 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
|||
* FIXME: Why this?
|
||||
*/
|
||||
Thread->KernelApcDisable = 1;
|
||||
Thread->UserAffinity = 0;
|
||||
Thread->UserAffinity = Process->Affinity;
|
||||
Thread->SystemAffinityActive = 0;
|
||||
Thread->Queue = NULL;
|
||||
KeInitializeSpinLock(&Thread->ApcQueueLock);
|
||||
memset(&Thread->Timer, 0, sizeof(KTIMER));
|
||||
Thread->QueueListEntry.Flink = NULL;
|
||||
Thread->QueueListEntry.Blink = NULL;
|
||||
Thread->Affinity = 0;
|
||||
Thread->Affinity = Process->Affinity;
|
||||
Thread->Preempted = 0;
|
||||
Thread->ProcessReadyQueue = 0;
|
||||
Thread->KernelStackResident = 1;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: main.c,v 1.89 2001/04/16 02:02:04 dwelch Exp $
|
||||
/* $Id: main.c,v 1.90 2001/04/16 16:29:02 dwelch Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/main.c
|
||||
|
@ -470,13 +470,6 @@ ExpInitializeExecutive(VOID)
|
|||
}
|
||||
HalDisplayString(str);
|
||||
|
||||
#ifdef MP
|
||||
|
||||
DbgPrint("BSP halted\n");
|
||||
for (;;);
|
||||
|
||||
#endif /* MP */
|
||||
|
||||
/*
|
||||
* Initialize various critical subsystems
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.61 2001/04/16 02:02:06 dwelch Exp $
|
||||
/* $Id: process.c,v 1.62 2001/04/16 16:29:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -48,7 +48,8 @@ static GENERIC_MAPPING PiProcessMapping = {PROCESS_READ,
|
|||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
PEPROCESS PsGetNextProcess(PEPROCESS OldProcess)
|
||||
PEPROCESS
|
||||
PsGetNextProcess(PEPROCESS OldProcess)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PEPROCESS NextProcess;
|
||||
|
@ -87,9 +88,10 @@ PEPROCESS PsGetNextProcess(PEPROCESS OldProcess)
|
|||
return(NextProcess);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL NtOpenProcessToken(IN HANDLE ProcessHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
OUT PHANDLE TokenHandle)
|
||||
NTSTATUS STDCALL
|
||||
NtOpenProcessToken(IN HANDLE ProcessHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
OUT PHANDLE TokenHandle)
|
||||
{
|
||||
PACCESS_TOKEN Token;
|
||||
NTSTATUS Status;
|
||||
|
@ -109,7 +111,8 @@ NTSTATUS STDCALL NtOpenProcessToken(IN HANDLE ProcessHandle,
|
|||
return(Status);
|
||||
}
|
||||
|
||||
PACCESS_TOKEN STDCALL PsReferencePrimaryToken(PEPROCESS Process)
|
||||
PACCESS_TOKEN STDCALL
|
||||
PsReferencePrimaryToken(PEPROCESS Process)
|
||||
{
|
||||
ObReferenceObjectByPointer(Process->Token,
|
||||
TOKEN_ALL_ACCESS,
|
||||
|
@ -118,8 +121,9 @@ PACCESS_TOKEN STDCALL PsReferencePrimaryToken(PEPROCESS Process)
|
|||
return(Process->Token);
|
||||
}
|
||||
|
||||
NTSTATUS PsOpenTokenOfProcess(HANDLE ProcessHandle,
|
||||
PACCESS_TOKEN* Token)
|
||||
NTSTATUS
|
||||
PsOpenTokenOfProcess(HANDLE ProcessHandle,
|
||||
PACCESS_TOKEN* Token)
|
||||
{
|
||||
PEPROCESS Process;
|
||||
NTSTATUS Status;
|
||||
|
@ -139,7 +143,8 @@ NTSTATUS PsOpenTokenOfProcess(HANDLE ProcessHandle,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID PiKillMostProcesses(VOID)
|
||||
VOID
|
||||
PiKillMostProcesses(VOID)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
|
@ -206,6 +211,8 @@ VOID PsInitProcessManagment(VOID)
|
|||
PROCESS_ALL_ACCESS,
|
||||
NULL,
|
||||
PsProcessType);
|
||||
/* System threads may run on any processor. */
|
||||
PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF;
|
||||
PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL;
|
||||
KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.DispatcherHeader,
|
||||
InternalProcessType,
|
||||
|
@ -391,7 +398,8 @@ NtCreateProcess (OUT PHANDLE ProcessHandle,
|
|||
sizeof(EPROCESS),
|
||||
FALSE);
|
||||
KProcess = &Process->Pcb;
|
||||
|
||||
/* Inherit parent process's affinity. */
|
||||
KProcess->Affinity = ParentProcess->Pcb.Affinity;
|
||||
KProcess->BasePriority = PROCESS_PRIO_NORMAL;
|
||||
MmInitializeAddressSpace(Process,
|
||||
&Process->AddressSpace);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.74 2001/04/16 02:02:07 dwelch Exp $
|
||||
/* $Id: thread.c,v 1.75 2001/04/16 16:29:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -71,7 +71,8 @@ HANDLE STDCALL PsGetCurrentThreadId(VOID)
|
|||
return(PsGetCurrentThread()->Cid.UniqueThread);
|
||||
}
|
||||
|
||||
VOID PsInsertIntoThreadList(KPRIORITY Priority, PETHREAD Thread)
|
||||
VOID
|
||||
PsInsertIntoThreadList(KPRIORITY Priority, PETHREAD Thread)
|
||||
{
|
||||
if (Priority >= MAXIMUM_PRIORITY || Priority < 0)
|
||||
{
|
||||
|
@ -115,8 +116,9 @@ VOID PsDumpThreads(VOID)
|
|||
}
|
||||
}
|
||||
|
||||
static PETHREAD PsScanThreadList (KPRIORITY Priority)
|
||||
static PETHREAD PsScanThreadList (KPRIORITY Priority, ULONG Affinity)
|
||||
{
|
||||
#if 0
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
|
||||
|
@ -132,6 +134,23 @@ static PETHREAD PsScanThreadList (KPRIORITY Priority)
|
|||
}
|
||||
|
||||
return(current);
|
||||
#else
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
|
||||
current_entry = PriorityListHead[Priority].Flink;
|
||||
while (current_entry != &PriorityListHead[Priority])
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry, ETHREAD,
|
||||
Tcb.QueueListEntry);
|
||||
if (current->Tcb.UserAffinity & Affinity)
|
||||
{
|
||||
return(current);
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
return(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,6 +158,7 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
|||
{
|
||||
KPRIORITY CurrentPriority;
|
||||
PETHREAD Candidate;
|
||||
ULONG Affinity;
|
||||
|
||||
CurrentThread->Tcb.State = NewThreadStatus;
|
||||
if (CurrentThread->Tcb.State == THREAD_STATE_RUNNABLE)
|
||||
|
@ -148,11 +168,12 @@ VOID PsDispatchThreadNoLock (ULONG NewThreadStatus)
|
|||
CurrentThread);
|
||||
}
|
||||
|
||||
Affinity = 1 << KeGetCurrentProcessorNumber();
|
||||
for (CurrentPriority = HIGH_PRIORITY;
|
||||
CurrentPriority >= LOW_PRIORITY;
|
||||
CurrentPriority--)
|
||||
{
|
||||
Candidate = PsScanThreadList(CurrentPriority);
|
||||
Candidate = PsScanThreadList(CurrentPriority, Affinity);
|
||||
if (Candidate == CurrentThread)
|
||||
{
|
||||
KeReleaseSpinLockFromDpcLevel(&PiThreadListLock);
|
||||
|
@ -313,7 +334,7 @@ PsInitThreadManagment(VOID)
|
|||
FirstThread->Tcb.State = THREAD_STATE_RUNNING;
|
||||
FirstThread->Tcb.FreezeCount = 0;
|
||||
CurrentThread = FirstThread;
|
||||
CURRENT_KPCR->CurrentThread = (PVOID)FirstThread;
|
||||
KeGetCurrentKPCR()->CurrentThread = (PVOID)FirstThread;
|
||||
NtClose(FirstThreadHandle);
|
||||
|
||||
DPRINT("FirstThread %x\n",FirstThread);
|
||||
|
|
Loading…
Reference in a new issue