- Initialize the pcr for an application processor before it is booted.

- Initialize the dpc implementation for the boot processor earlier.

svn path=/trunk/; revision=11501
This commit is contained in:
Hartmut Birr
2004-10-31 13:20:58 +00:00
parent 780bd8e919
commit 0ca2950639
3 changed files with 39 additions and 29 deletions
+2 -1
View File
@@ -40,6 +40,7 @@ VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2);
struct _KTHREAD;
struct _KIRQ_TRAPFRAME;
struct _KPCR;
VOID STDCALL
DbgBreakPointNoBugCheck(VOID);
@@ -100,7 +101,7 @@ extern LARGE_INTEGER SystemBootTime;
VOID KeInitExceptions(VOID);
VOID KeInitInterrupts(VOID);
VOID KeInitTimer(VOID);
VOID KeInitDpc(VOID);
VOID KeInitDpc(struct _KPCR* Pcr);
VOID KeInitDispatcher(VOID);
VOID KeInitializeDispatcher(VOID);
VOID KeInitializeTimerImpl(VOID);
+2 -4
View File
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dpc.c,v 1.41 2004/10/30 23:48:56 navaraf Exp $
/* $Id: dpc.c,v 1.42 2004/10/31 13:20:58 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -288,13 +288,11 @@ KeSetTargetProcessorDpc (IN PKDPC Dpc,
}
VOID INIT_FUNCTION
KeInitDpc(VOID)
KeInitDpc(PKPCR Pcr)
/*
* FUNCTION: Initialize DPC handling
*/
{
PKPCR Pcr;
Pcr = KeGetCurrentKPCR();
InitializeListHead(&Pcr->PrcbData.DpcData[0].DpcListHead);
KeInitializeSpinLock(&Pcr->PrcbData.DpcData[0].DpcLock);
Pcr->PrcbData.MaximumDpcQueueDepth = 0;
+35 -24
View File
@@ -35,7 +35,6 @@
ULONG KiPcrInitDone = 0;
static ULONG PcrsAllocated = 0;
static PFN_TYPE PcrPages[MAXIMUM_PROCESSORS];
ULONG Ke386CpuidFlags, Ke386CpuidFlags2, Ke386CpuidExFlags;
ULONG Ke386Cpuid = 0x300;
ULONG Ke386CacheAlignment;
@@ -128,15 +127,42 @@ Ki386GetCpuId(VOID)
VOID INIT_FUNCTION
KePrepareForApplicationProcessorInit(ULONG Id)
{
MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &PcrPages[Id]);
DPRINT("KePrepareForApplicationProcessorInit(Id %d)\n", Id);
PFN_TYPE PrcPfn;
PKPCR Pcr;
Pcr = (PKPCR)((ULONG_PTR)KPCR_BASE + Id * PAGE_SIZE);
MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &PrcPfn);
MmCreateVirtualMappingForKernel((PVOID)Pcr,
PAGE_READWRITE,
&PrcPfn,
1);
/*
* Create a PCR for this processor
*/
memset(Pcr, 0, PAGE_SIZE);
Pcr->ProcessorNumber = Id;
Pcr->Tib.Self = &Pcr->Tib;
Pcr->Self = Pcr;
Pcr->Irql = HIGH_LEVEL;
/* Mark the end of the exception handler list */
Pcr->Tib.ExceptionList = (PVOID)-1;
KeInitDpc(Pcr);
KiGdtPrepareForApplicationProcessorInit(Id);
}
VOID
KeApplicationProcessorInit(VOID)
{
PKPCR KPCR;
ULONG Offset;
PKPCR Pcr;
DPRINT("KeApplicationProcessorInit()\n");
if (Ke386CpuidFlags & X86_FEATURE_PGE)
{
@@ -150,30 +176,14 @@ KeApplicationProcessorInit(VOID)
MiEnablePAE(NULL);
}
/*
* Create a PCR for this processor
*/
Offset = InterlockedIncrement((LONG *)&PcrsAllocated) - 1;
KPCR = (PKPCR)(KPCR_BASE + (Offset * PAGE_SIZE));
MmCreateVirtualMappingForKernel((PVOID)KPCR,
PAGE_READWRITE,
&PcrPages[Offset],
1);
memset(KPCR, 0, PAGE_SIZE);
KPCR->ProcessorNumber = (UCHAR)Offset;
KPCR->Tib.Self = &KPCR->Tib;
KPCR->Self = KPCR;
KPCR->Irql = HIGH_LEVEL;
/* Mark the end of the exception handler list */
KPCR->Tib.ExceptionList = (PVOID)-1;
Offset = InterlockedIncrement(&PcrsAllocated) - 1;
Pcr = (PKPCR)((ULONG_PTR)KPCR_BASE + Offset * PAGE_SIZE);
/*
* Initialize the GDT
*/
KiInitializeGdt(KPCR);
KeInitDpc();
KiInitializeGdt(Pcr);
/*
* It is now safe to process interrupts
@@ -228,6 +238,8 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress)
KiPcrInitDone = 1;
PcrsAllocated++;
KeInitDpc(KPCR);
/* Mark the end of the exception handler list */
KPCR->Tib.ExceptionList = (PVOID)-1;
@@ -307,7 +319,6 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress)
VOID INIT_FUNCTION
KeInit2(VOID)
{
KeInitDpc();
KeInitializeBugCheck();
KeInitializeDispatcher();
KeInitializeTimerImpl();