Author: ros-arm-bringup
Date: Sun Jul 13 20:41:44 2008
New Revision: 34487
URL: http://svn.reactos.org/svn/reactos?rev=34487&view=rev
Log:
- Force a 5 second wait before loading drivers, on ARM.
- Context switching doesn't really work -- but we've been lucky since we're stuck on a priority 31 thread.
- Instead of worrying about this later when the system will be fully operational, this forces us to expose these bugs, and to make sure everything works.
- This will stress our context switching, waiting, unwaiting and scheduling code on ARM but once it all works well, after 5 seconds we'll be back on track.
Modified:
trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=344…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sun Jul 13 20:41:44 2008
@@ -1703,6 +1703,17 @@
/* Initialize in-place execution support */
XIPInit(LoaderBlock);
+
+#ifdef _M_ARM
+ //
+ // ARM: Force a wait so we can test thread scheduling, timing and context switching
+ //
+ DPRINT1("Beginning 5 second wait...\n");
+ Timeout.QuadPart = Int32x32To64(5, -10000000);
+ KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
+ DPRINT1("Wait complete\n");
+ while (TRUE);
+#endif
/* Set maximum update to 75% */
InbvSetProgressBarSubset(25, 75);
Author: ros-arm-bringup
Date: Sun Jul 13 19:26:18 2008
New Revision: 34486
URL: http://svn.reactos.org/svn/reactos?rev=34486&view=rev
Log:
- Increment the PC by 4 during a DebugService-style trap, just like on x86, so that we can skip the actual instruction when we're done.
- Exit the trap after a prefetch abort. DbgPrint fully works now, and we're back where we started -- RamdiskCreateDiskDevice.
Modified:
trunk/reactos/ntoskrnl/ke/arm/trapc.c
Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Sun Jul 13 19:26:18 2008
@@ -458,6 +458,7 @@
// Debug Service
//
Parameter0 = TrapFrame->R0;
+ TrapFrame->Pc += sizeof(ULONG);
}
else
{
@@ -491,10 +492,11 @@
TrapFrame,
KiGetPreviousMode(TrapFrame),
TRUE);
- //
- // TODO
- //
- while (TRUE);
+
+ //
+ // We're done
+ //
+ return STATUS_SUCCESS;
}
//
Author: ros-arm-bringup
Date: Sun Jul 13 19:24:33 2008
New Revision: 34485
URL: http://svn.reactos.org/svn/reactos?rev=34485&view=rev
Log:
- ARM instructions are 4 bytes long, not 1, so decrement the PC by four during breakpoints (so the caller gets the address of the previous instruction, just like on x86).
Modified:
trunk/reactos/ntoskrnl/ke/arm/exp.c
Modified: trunk/reactos/ntoskrnl/ke/arm/exp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/exp.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] Sun Jul 13 19:24:33 2008
@@ -213,9 +213,9 @@
case STATUS_BREAKPOINT:
//
- // Decrement PC by one
- //
- Context.Pc--;
+ // We want the instruction right before the int 3
+ //
+ Context.Pc -= sizeof(ULONG);
break;
//
Author: ros-arm-bringup
Date: Sun Jul 13 19:04:53 2008
New Revision: 34483
URL: http://svn.reactos.org/svn/reactos?rev=34483&view=rev
Log:
- Implement KeContextToTrapFrame.
- No, we don't sanitize anything right now. There's no user-mode at this point, so it doesn't matter. If you think we should sanitize right now, you need to get out and get laid.
- So this brings us back to KiPrefetchAbortHandler's while (TRUE).
- We have to make sure the funky PC modifications are going to work well, and after that, we can exit the trap.
Modified:
trunk/reactos/ntoskrnl/ke/arm/exp.c
trunk/reactos/ntoskrnl/ke/arm/trapc.c
Modified: trunk/reactos/ntoskrnl/ke/arm/exp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/exp.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/exp.c [iso-8859-1] Sun Jul 13 19:04:53 2008
@@ -29,8 +29,73 @@
IN ULONG ContextFlags,
IN KPROCESSOR_MODE PreviousMode)
{
- while (TRUE);
- return;
+ KIRQL OldIrql;
+
+ //
+ // Do this at APC_LEVEL
+ //
+ OldIrql = KeGetCurrentIrql();
+ if (OldIrql < APC_LEVEL) KeRaiseIrql(APC_LEVEL, &OldIrql);
+
+ //
+ // Start with the Control flags
+ //
+ if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
+ {
+ //
+ // So this basically means all the special stuff
+ //
+ if (PreviousMode == UserMode)
+ {
+ //
+ // ARM has register banks
+ //
+ TrapFrame->UserSp = Context->Sp;
+ TrapFrame->UserLr = Context->Lr;
+ }
+ else
+ {
+ //
+ // ARM has register banks
+ //
+ TrapFrame->SvcSp = Context->Sp;
+ TrapFrame->SvcLr = Context->Lr;
+ }
+
+ //
+ // The rest is already in the right mode
+ //
+ TrapFrame->Pc = Context->Pc;
+ TrapFrame->Spsr = Context->Psr;
+ }
+
+ //
+ // Now do the integers
+ //
+ if ((Context->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER)
+ {
+ //
+ // Basically everything else but FPU
+ //
+ TrapFrame->R0 = Context->R0;
+ TrapFrame->R1 = Context->R1;
+ TrapFrame->R2 = Context->R2;
+ TrapFrame->R3 = Context->R3;
+ TrapFrame->R4 = Context->R4;
+ TrapFrame->R5 = Context->R5;
+ TrapFrame->R6 = Context->R6;
+ TrapFrame->R7 = Context->R7;
+ TrapFrame->R8 = Context->R8;
+ TrapFrame->R0 = Context->R9;
+ TrapFrame->R10 = Context->R10;
+ TrapFrame->R11 = Context->R11;
+ TrapFrame->R12 = Context->R12;
+ }
+
+ //
+ // Restore IRQL
+ //
+ if (OldIrql < APC_LEVEL) KeLowerIrql(OldIrql);
}
VOID
@@ -55,7 +120,7 @@
//
// So this basically means all the special stuff
//
- if (KiGetPreviousMode(TrapFrame))
+ if (KiGetPreviousMode(TrapFrame) == UserMode)
{
//
// ARM has register banks
Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Sun Jul 13 19:04:53 2008
@@ -491,7 +491,6 @@
TrapFrame,
KiGetPreviousMode(TrapFrame),
TRUE);
-
//
// TODO
//