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
//