mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 10:51:41 +00:00
[NTOS]: Update code to use new KPCR structure.
[NTOS]: Make all trap code currently spin forever, because it has not been reviewed yet. svn path=/trunk/; revision=45512
This commit is contained in:
parent
ba3bc4340e
commit
6995f3fca6
2 changed files with 32 additions and 14 deletions
|
@ -25,6 +25,9 @@ KiIdleLoop(VOID)
|
||||||
//
|
//
|
||||||
// Loop forever... that's why this is an idle loop
|
// Loop forever... that's why this is an idle loop
|
||||||
//
|
//
|
||||||
|
DPRINT1("[IDLE LOOP]\n");
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -117,10 +120,13 @@ BOOLEAN
|
||||||
KiSwapContextInternal(IN PKTHREAD OldThread,
|
KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
IN PKTHREAD NewThread)
|
IN PKTHREAD NewThread)
|
||||||
{
|
{
|
||||||
PKPCR Pcr = (PKPCR)KeGetPcr();
|
PKIPCR Pcr = (PKIPCR)KeGetPcr();
|
||||||
PKPRCB Prcb = Pcr->Prcb;
|
PKPRCB Prcb = Pcr->Prcb;
|
||||||
PKPROCESS OldProcess, NewProcess;
|
PKPROCESS OldProcess, NewProcess;
|
||||||
|
|
||||||
|
DPRINT1("SWAP\n");
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increase context switch count
|
// Increase context switch count
|
||||||
//
|
//
|
||||||
|
@ -163,7 +169,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// Increase thread context switches
|
// Increase thread context switches
|
||||||
//
|
//
|
||||||
NewThread->ContextSwitches++;
|
NewThread->ContextSwitches++;
|
||||||
|
#if 0 // I don't buy this
|
||||||
//
|
//
|
||||||
// Set us as the current thread
|
// Set us as the current thread
|
||||||
// NOTE: On RISC Platforms, there is both a KPCR CurrentThread, and a
|
// NOTE: On RISC Platforms, there is both a KPCR CurrentThread, and a
|
||||||
|
@ -175,7 +181,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// there as well.
|
// there as well.
|
||||||
//
|
//
|
||||||
Pcr->CurrentThread = NewThread;
|
Pcr->CurrentThread = NewThread;
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
// DPCs shouldn't be active
|
// DPCs shouldn't be active
|
||||||
//
|
//
|
||||||
|
@ -221,7 +227,9 @@ KiApcInterrupt(VOID)
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
KEXCEPTION_FRAME ExceptionFrame;
|
KEXCEPTION_FRAME ExceptionFrame;
|
||||||
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
||||||
//DPRINT1("[APC]\n");
|
|
||||||
|
DPRINT1("[APC TRAP]\n");
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Isolate previous mode
|
// Isolate previous mode
|
||||||
|
@ -257,14 +265,17 @@ KiApcInterrupt(VOID)
|
||||||
VOID
|
VOID
|
||||||
KiDispatchInterrupt(VOID)
|
KiDispatchInterrupt(VOID)
|
||||||
{
|
{
|
||||||
PKPCR Pcr;
|
PKIPCR Pcr;
|
||||||
PKPRCB Prcb;
|
PKPRCB Prcb;
|
||||||
PKTHREAD NewThread, OldThread;
|
PKTHREAD NewThread, OldThread;
|
||||||
|
|
||||||
|
DPRINT1("[DPC TRAP]\n");
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the PCR and disable interrupts
|
// Get the PCR and disable interrupts
|
||||||
//
|
//
|
||||||
Pcr = (PKPCR)KeGetPcr();
|
Pcr = (PKIPCR)KeGetPcr();
|
||||||
Prcb = Pcr->Prcb;
|
Prcb = Pcr->Prcb;
|
||||||
_disable();
|
_disable();
|
||||||
|
|
||||||
|
@ -339,14 +350,14 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
|
||||||
{
|
{
|
||||||
KIRQL OldIrql, Irql;
|
KIRQL OldIrql, Irql;
|
||||||
ULONG InterruptCause, InterruptMask;
|
ULONG InterruptCause, InterruptMask;
|
||||||
PKPCR Pcr;
|
PKIPCR Pcr;
|
||||||
PKTRAP_FRAME OldTrapFrame;
|
PKTRAP_FRAME OldTrapFrame;
|
||||||
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increment interrupt count
|
// Increment interrupt count
|
||||||
//
|
//
|
||||||
Pcr = (PKPCR)KeGetPcr();
|
Pcr = (PKIPCR)KeGetPcr();
|
||||||
Pcr->Prcb->InterruptCount++;
|
Pcr->Prcb->InterruptCount++;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -359,7 +370,7 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
|
||||||
// Get the interrupt source
|
// Get the interrupt source
|
||||||
//
|
//
|
||||||
InterruptCause = HalGetInterruptSource();
|
InterruptCause = HalGetInterruptSource();
|
||||||
// DPRINT1("[INT] (%x) @ %p %p\n", InterruptCause, TrapFrame->SvcLr, TrapFrame->Pc);
|
//DPRINT1("[INT] (%x) @ %p %p\n", InterruptCause, TrapFrame->SvcLr, TrapFrame->Pc);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the new IRQL and Interrupt Mask
|
// Get the new IRQL and Interrupt Mask
|
||||||
|
@ -421,6 +432,10 @@ KiPrefetchAbortHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
ULONG DebugType, Parameter0;
|
ULONG DebugType, Parameter0;
|
||||||
EXCEPTION_RECORD ExceptionRecord;
|
EXCEPTION_RECORD ExceptionRecord;
|
||||||
|
|
||||||
|
DPRINT1("[PREFETCH ABORT] (%x) @ %p/%p/%p\n",
|
||||||
|
KeArmInstructionFaultStatusRegisterGet(), Address, TrapFrame->SvcLr, TrapFrame->Pc);
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// What we *SHOULD* do is look at the instruction fault status register
|
// What we *SHOULD* do is look at the instruction fault status register
|
||||||
// and see if it's equal to 2 (debug trap). Unfortunately QEMU doesn't seem
|
// and see if it's equal to 2 (debug trap). Unfortunately QEMU doesn't seem
|
||||||
|
@ -483,8 +498,6 @@ KiPrefetchAbortHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
//
|
//
|
||||||
// Unhandled
|
// Unhandled
|
||||||
//
|
//
|
||||||
DPRINT1("[PREFETCH ABORT] (%x) @ %p/%p/%p\n",
|
|
||||||
KeArmInstructionFaultStatusRegisterGet(), Address, TrapFrame->SvcLr, TrapFrame->Pc);
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -497,6 +510,10 @@ KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
PVOID Address = (PVOID)KeArmFaultAddressRegisterGet();
|
PVOID Address = (PVOID)KeArmFaultAddressRegisterGet();
|
||||||
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
||||||
|
|
||||||
|
DPRINT1("[ABORT] (%x) @ %p/%p/%p\n",
|
||||||
|
KeArmFaultStatusRegisterGet(), Address, TrapFrame->SvcLr, TrapFrame->Pc);
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if this is a page fault
|
// Check if this is a page fault
|
||||||
//
|
//
|
||||||
|
@ -512,8 +529,6 @@ KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
//
|
//
|
||||||
// Unhandled
|
// Unhandled
|
||||||
//
|
//
|
||||||
DPRINT1("[ABORT] (%x) @ %p/%p/%p\n",
|
|
||||||
KeArmFaultStatusRegisterGet(), Address, TrapFrame->SvcLr, TrapFrame->Pc);
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -527,6 +542,9 @@ KiSoftwareInterruptHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
ULONG Instruction;
|
ULONG Instruction;
|
||||||
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
||||||
|
|
||||||
|
DPRINT1("[SWI] @ %p/%p\n", TrapFrame->SvcLr, TrapFrame->Pc);
|
||||||
|
while (TRUE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the current thread
|
// Get the current thread
|
||||||
//
|
//
|
||||||
|
|
|
@ -226,7 +226,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
//
|
//
|
||||||
// Forcibly put us in a sane state
|
// Forcibly put us in a sane state
|
||||||
//
|
//
|
||||||
KeGetPcr()->CurrentIrql = 0;
|
KeGetPcr()->Irql = 0;
|
||||||
_disable();
|
_disable();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue