[ros-diffs] [ros-arm-bringup] 33970: - We now implement the idle loop (thanks for fixing the interrupt code...). - We are now back to HalInitSystem just like before the previous fixes. - Now we'll implement stall calibration and switch to the clock interrupt.
ros-arm-bringup at svn.reactos.org
ros-arm-bringup at svn.reactos.org
Sun Jun 15 00:48:30 CEST 2008
- Previous message: [ros-diffs] [ros-arm-bringup] 33969: - Implement the basic stall interrupt to be used to calculate the factors for KeStallExecution (using NT MIPS algorithm, hope this will work) - Also written KeStallExecution. - Now, we are back to where we hang before Phase 1 (so Phase 1 doesn't occur anymore). - This hang is because we used to do a DPC here, which isn't good, since IRQL is already at dispatch. - Instead, the correct course of action is to enter the idle loop, which will schedule the phase 1 thread. - But, we don't have an idle loop yet ; -)
- Next message: [ros-diffs] [ros-arm-bringup] 33971: - Dude, we don't need to calibrate anything... we've got a 1MHz timer, which means 1us-precision. KeStallExecutionProcessor needs 1us-precision! - Since we have two timers (ha x86!!!), set the second one as the stall timer. It's a one-shot periodic timer, set to the exact number of microseconds being waited on. - To fully emulate stalling, we don't use a clock interrupt for it (it supports not sending one!) and just busy-loop until the value reaches 0. - Tried it with a 10 second (10000000 us) wait and it worked -perfectly-. - Re-implemented KeStallExecutionProcessor and got rid of the other code. Back in HalInitSystem(phase1) now... - Also killed some DPRINT1s getting on my nerves.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: ros-arm-bringup
Date: Sat Jun 14 17:48:30 2008
New Revision: 33970
URL: http://svn.reactos.org/svn/reactos?rev=33970&view=rev
Log:
- We now implement the idle loop (thanks for fixing the interrupt code...).
- We are now back to HalInitSystem just like before the previous fixes.
- Now we'll implement stall calibration and switch to the clock interrupt.
Modified:
trunk/reactos/ntoskrnl/ke/arm/kiinit.c
trunk/reactos/ntoskrnl/ke/arm/trapc.c
Modified: trunk/reactos/ntoskrnl/ke/arm/kiinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/kiinit.c?rev=33970&r1=33969&r2=33970&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/kiinit.c [iso-8859-1] Sat Jun 14 17:48:30 2008
@@ -22,6 +22,9 @@
#define __ARMV6__ KeIsArmV6
/* FUNCTIONS ******************************************************************/
+
+VOID
+KiIdleLoop(VOID);
VOID
DebugService(IN ULONG ServiceType,
@@ -495,5 +498,5 @@
//
// Jump to idle loop
//
- while (TRUE);
+ KiIdleLoop();
}
Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?rev=33970&r1=33969&r2=33970&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Sat Jun 14 17:48:30 2008
@@ -32,6 +32,81 @@
VOID FASTCALL
HalClearSoftwareInterrupt(IN KIRQL Request);
+
+VOID
+KiIdleLoop(VOID)
+{
+ PKPCR Pcr = (PKPCR)KeGetPcr();
+ PKPRCB Prcb = Pcr->Prcb;
+ PKTHREAD OldThread, NewThread;
+
+ //
+ // Loop forever... that's why this is an idle loop
+ //
+ while (TRUE)
+ {
+ //
+ // Cycle interrupts
+ //
+ _disable();
+ _enable();
+
+ //
+ // Check if there's DPC work to do
+ //
+ if ((Prcb->DpcData[0].DpcQueueDepth) ||
+ (Prcb->TimerRequest) ||
+ (Prcb->DeferredReadyListHead.Next))
+ {
+ //
+ // Clear the pending interrupt
+ //
+ HalClearSoftwareInterrupt(DISPATCH_LEVEL);
+
+ //
+ // FIXME: TODO
+ //
+ DPRINT1("DPC/Timer Delivery!\n");
+ while (TRUE);
+ }
+
+ //
+ // Check if there's a thread to schedule
+ //
+ if (Prcb->NextThread)
+ {
+ //
+ // Out with the old, in with the new...
+ //
+ OldThread = Prcb->CurrentThread;
+ NewThread = Prcb->NextThread;
+ Prcb->CurrentThread = NewThread;
+ Prcb->NextThread = NULL;
+
+ //
+ // Update thread state
+ //
+ NewThread->State = Running;
+
+ //
+ // Swap to the new thread
+ // On ARM we call KiSwapContext instead of KiSwapContextInternal,
+ // because we're calling this from C code and not assembly.
+ // This is similar to how it gets called for unwaiting, on x86
+ //
+ DPRINT1("Swapping context!\n");
+ KiSwapContext(OldThread, NewThread);
+ DPRINT1("Back\n");
+ while (TRUE);
+ }
+ else
+ {
+ //
+ // FIXME: Wait-For-Interrupt ARM Opcode
+ //
+ }
+ }
+}
BOOLEAN
KiSwapContextInternal(IN PKTHREAD OldThread,
@@ -155,20 +230,22 @@
KiDispatchInterrupt(VOID)
{
PKPCR Pcr;
+ PKPRCB Prcb;
PKTHREAD NewThread, OldThread;
//
// Get the PCR and disable interrupts
//
Pcr = (PKPCR)KeGetPcr();
+ Prcb = Pcr->Prcb;
_disable();
//
//Check if we have to deliver DPCs, timers, or deferred threads
//
- if ((Pcr->Prcb->DpcData[0].DpcQueueDepth) ||
- (Pcr->Prcb->TimerRequest) ||
- (Pcr->Prcb->DeferredReadyListHead.Next))
+ if ((Prcb->DpcData[0].DpcQueueDepth) ||
+ (Prcb->TimerRequest) ||
+ (Prcb->DeferredReadyListHead.Next))
{
//
// FIXME: TODO
@@ -185,7 +262,7 @@
//
// Check for quantum end
//
- if (Pcr->Prcb->QuantumEnd)
+ if (Prcb->QuantumEnd)
{
//
// FIXME: TODO
@@ -198,15 +275,15 @@
//
// Check if we have a thread to swap to
//
- if (Pcr->Prcb->NextThread)
+ if (Prcb->NextThread)
{
//
// Next is now current
//
- OldThread = Pcr->Prcb->CurrentThread;
- NewThread = Pcr->Prcb->NextThread;
- Pcr->Prcb->CurrentThread = NewThread;
- Pcr->Prcb->NextThread = NULL;
+ OldThread = Prcb->CurrentThread;
+ NewThread = Prcb->NextThread;
+ Prcb->CurrentThread = NewThread;
+ Prcb->NextThread = NULL;
//
// Update thread states
@@ -217,7 +294,7 @@
//
// Make the old thread ready
//
- KxQueueReadyThread(OldThread, Pcr->Prcb);
+ KxQueueReadyThread(OldThread, Prcb);
//
// Swap to the new thread
@@ -227,6 +304,7 @@
//
DPRINT1("Swapping context!\n");
KiSwapContext(OldThread, NewThread);
+ DPRINT1("Back\n");
while (TRUE);
}
}
- Previous message: [ros-diffs] [ros-arm-bringup] 33969: - Implement the basic stall interrupt to be used to calculate the factors for KeStallExecution (using NT MIPS algorithm, hope this will work) - Also written KeStallExecution. - Now, we are back to where we hang before Phase 1 (so Phase 1 doesn't occur anymore). - This hang is because we used to do a DPC here, which isn't good, since IRQL is already at dispatch. - Instead, the correct course of action is to enter the idle loop, which will schedule the phase 1 thread. - But, we don't have an idle loop yet ; -)
- Next message: [ros-diffs] [ros-arm-bringup] 33971: - Dude, we don't need to calibrate anything... we've got a 1MHz timer, which means 1us-precision. KeStallExecutionProcessor needs 1us-precision! - Since we have two timers (ha x86!!!), set the second one as the stall timer. It's a one-shot periodic timer, set to the exact number of microseconds being waited on. - To fully emulate stalling, we don't use a clock interrupt for it (it supports not sending one!) and just busy-loop until the value reaches 0. - Tried it with a 10 second (10000000 us) wait and it worked -perfectly-. - Re-implemented KeStallExecutionProcessor and got rid of the other code. Back in HalInitSystem(phase1) now... - Also killed some DPRINT1s getting on my nerves.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list