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


svn path=/trunk/; revision=34483
This commit is contained in:
ReactOS Portable Systems Group 2008-07-14 00:04:53 +00:00
parent ed3125b4e0
commit 631d627fa7
2 changed files with 68 additions and 4 deletions

View file

@ -29,8 +29,73 @@ KeContextToTrapFrame(IN PCONTEXT Context,
IN ULONG ContextFlags, IN ULONG ContextFlags,
IN KPROCESSOR_MODE PreviousMode) IN KPROCESSOR_MODE PreviousMode)
{ {
while (TRUE); KIRQL OldIrql;
return;
//
// 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 VOID
@ -55,7 +120,7 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame,
// //
// So this basically means all the special stuff // So this basically means all the special stuff
// //
if (KiGetPreviousMode(TrapFrame)) if (KiGetPreviousMode(TrapFrame) == UserMode)
{ {
// //
// ARM has register banks // ARM has register banks

View file

@ -491,7 +491,6 @@ KiPrefetchAbortHandler(IN PKTRAP_FRAME TrapFrame)
TrapFrame, TrapFrame,
KiGetPreviousMode(TrapFrame), KiGetPreviousMode(TrapFrame),
TRUE); TRUE);
// //
// TODO // TODO
// //