- Implement HalProcessorIdle.

- Fix KiIdleLoop to actuall load the PCR in EBX. It was using a completely random value.
- Call the Processor Idle Routine now, isntead of hard-coding STI+HLT. This routine had already been setup during bootup by PoInitailizePrcb.
- Implemented PopIdle0 and made it call HalProcessorIdle. No performance/throttling is done yet.

svn path=/trunk/; revision=24063
This commit is contained in:
Alex Ionescu 2006-09-11 06:50:19 +00:00
parent 81997fc0bc
commit c19a362969
6 changed files with 26 additions and 20 deletions

View file

@ -45,18 +45,6 @@ HalHandleNMI(PVOID NmiInfo)
KeEnterKernelDebugger ();
}
VOID STDCALL
HalProcessorIdle(VOID)
{
#if 1
Ki386EnableInterrupts();
Ki386HaltProcessor();
#else
#endif
}
ULONG FASTCALL
HalSystemVectorDispatchEntry (
ULONG Unknown1,

View file

@ -47,4 +47,12 @@ HalStartNextProcessor(ULONG Unknown1,
return TRUE;
}
VOID
NTAPI
HalProcessorIdle(VOID)
{
Ki386EnableInterrupts();
Ki386HaltProcessor();
}
/* EOF */

View file

@ -176,6 +176,7 @@ Author:
#define KPCR_PRCB_TIMER_REQUEST 0xA88
#define KPCR_PRCB_QUANTUM_END 0xAA1
#define KPCR_PRCB_DEFERRED_READY_LIST_HEAD 0xC10
#define KPCR_PRCB_POWER_STATE_IDLE_FUNCTION 0xEC0
//
// KINTERRUPT Offsets

View file

@ -88,6 +88,16 @@ HalStartNextProcessor(
ULONG Unknown2
);
//
// CPU Routines
//
NTHALAPI
VOID
NTAPI
HalProcessorIdle(
VOID
);
//
// Interrupt Functions
//

View file

@ -518,18 +518,16 @@ BugCheckDpc:
.func @KiIdleLoop@0, @KiIdleLoop@0
@KiIdleLoop@0:
/* Set EBX */
mov ebx, fs:[KPCR_SELF]
/* Jump into mainline code */
jmp MainLoop
CpuIdle:
/* Call the CPU's idle function */
#if 0
lea ecx, [ebx+KPCR_PRCB_POWER_STATE_IDLE_FUNCTION]
call [ecx]
#else
sti
hlt
#endif
MainLoop:
/* Cycle interrupts for 1 cycle */

View file

@ -340,9 +340,10 @@ PopPerfIdleDpc(IN PKDPC Dpc,
VOID
FASTCALL
PopIdle0(IN PKPRCB Prcb)
PopIdle0(IN PPROCESSOR_POWER_STATE PowerState)
{
DPRINT1("Idle function: %p\n", Prcb);
/* FIXME: Extremly naive implementation */
HalProcessorIdle();
}
VOID
@ -358,7 +359,7 @@ PoInitializePrcb(IN PKPRCB Prcb)
/* Initialize the Perf DPC and Timer */
KeInitializeDpc(&Prcb->PowerState.PerfDpc, PopPerfIdleDpc, Prcb);
//KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->Number);
KeInitializeTimerEx(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
}