mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 00:43:21 +00:00
- Enable interrupts after probing and capturing parameters during a system call.
- Enable WFI during idle loop. - Implement undefined exception handler, and get rid of reserved exception code -- this will never happen except for an SoC bug. - Request an APC interrupt if the new thread we context switched to has APCs pending and enabled. - Perform DPC watchdog debugging code if a DPC lasted more than a second. - Do the appropriate bugcheck if DPCs are active during a context switch. - Go over the FIXMEs in the assembly files too, and create a new FIXME-PERF category. svn path=/trunk/; revision=34584
This commit is contained in:
parent
b95845bf85
commit
c0cde8777b
|
@ -148,5 +148,11 @@ KeArmFlushIcache(VOID)
|
|||
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 0" : : "r"(0) : "cc");
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
KeArmWaitForInterrupt(VOID)
|
||||
{
|
||||
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c0, 4" : : "r"(0) : "cc");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -155,6 +155,7 @@ extern UCHAR KiDebugRegisterContextOffsets[9];
|
|||
extern ULONG KeTimeIncrement;
|
||||
extern ULONG_PTR KiBugCheckData[5];
|
||||
extern ULONG KiFreezeFlag;
|
||||
extern ULONG KiDPCTimeout;
|
||||
|
||||
/* MACROS *************************************************************************/
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
//
|
||||
// Build exception frame
|
||||
// FIXME: Change to stmdb later
|
||||
// FIXME-PERF: Change to stmdb later
|
||||
//
|
||||
str r4, [sp, #ExR4]
|
||||
str r5, [sp, #ExR5]
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
//
|
||||
// Restore the registers
|
||||
// FIXME: Use LDMIA later
|
||||
// FIXME-PERF: Use LDMIA later
|
||||
//
|
||||
ldr r4, [sp, #ExR4]
|
||||
ldr r5, [sp, #ExR5]
|
||||
|
@ -84,11 +84,7 @@
|
|||
|
||||
NESTED_ENTRY KiThreadStartup
|
||||
PROLOG_END KiThreadStartup
|
||||
|
||||
//
|
||||
// FIXME: Make space on stack and clean it up?
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Lower to APC_LEVEL
|
||||
//
|
||||
|
|
|
@ -23,17 +23,6 @@ extern PVOID KiArmVectorTable;
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
DebugService2(IN ULONG Arg1,
|
||||
IN ULONG Arg2,
|
||||
IN ULONG Service)
|
||||
{
|
||||
//
|
||||
// FIXME-TODO: Implement this for symbol load and such
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiInitMachineDependent(VOID)
|
||||
|
|
|
@ -224,8 +224,31 @@ KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame,
|
|||
Prcb->DpcTime++;
|
||||
|
||||
//
|
||||
// FIXME-TODO: Handle DPC checks
|
||||
// Update Debug DPC time
|
||||
//
|
||||
Prcb->DebugDpcTime++;
|
||||
|
||||
//
|
||||
// Check if we've timed out
|
||||
//
|
||||
if (Prcb->DebugDpcTime >= KiDPCTimeout)
|
||||
{
|
||||
//
|
||||
// Print a message
|
||||
//
|
||||
DbgPrint("\n*** DPC routine > 1 sec --- This is not a break in "
|
||||
"KeUpdateSystemTime\n");
|
||||
|
||||
//
|
||||
// Break if a debugger is attached
|
||||
//
|
||||
if (KdDebuggerEnabled) DbgBreakPoint();
|
||||
|
||||
//
|
||||
// Restore the debug DPC time
|
||||
//
|
||||
Prcb->DebugDpcTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
ldr pc, _KiSoftwareInterruptJump // Software Interrupt
|
||||
ldr pc, _KiPrefetchAbortJump // Prefetch Abort
|
||||
ldr pc, _KiDataAbortJump // Data Abort
|
||||
ldr pc, _KiReservedJump // Reserved
|
||||
b . // Reserved
|
||||
ldr pc, _KiInterruptJump // Interrupt
|
||||
ldr pc, _KiFastInterruptJump // Fast Interrupt
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
|||
_KiSoftwareInterruptJump: .word KiSoftwareInterruptException
|
||||
_KiPrefetchAbortJump: .word KiPrefetchAbortException
|
||||
_KiDataAbortJump: .word KiDataAbortException
|
||||
_KiReservedJump: .word KiReservedException
|
||||
_KiInterruptJump: .word KiInterruptException
|
||||
_KiFastInterruptJump: .word KiFastInterruptException
|
||||
|
||||
|
@ -34,9 +33,22 @@
|
|||
PROLOG_END KiUndefinedInstructionException
|
||||
|
||||
//
|
||||
// FIXME: TODO
|
||||
// Handle trap entry
|
||||
//
|
||||
b .
|
||||
TRAP_PROLOG 0 // NotFromAbort
|
||||
|
||||
//
|
||||
// Call the C handler
|
||||
//
|
||||
adr lr, 1f
|
||||
mov r0, sp
|
||||
ldr pc, =KiUndefinedExceptionHandler
|
||||
|
||||
1:
|
||||
//
|
||||
// Handle trap exit
|
||||
//
|
||||
TRAP_EPILOG 0 // NotFromSystemCall
|
||||
|
||||
ENTRY_END KiUndefinedInstructionException
|
||||
|
||||
|
@ -137,19 +149,8 @@
|
|||
PROLOG_END KiFastInterruptException
|
||||
|
||||
//
|
||||
// FIXME: TODO
|
||||
// FIXME-PERF: Implement FIQ exception
|
||||
//
|
||||
b .
|
||||
|
||||
ENTRY_END KiFastInterruptException
|
||||
|
||||
|
||||
NESTED_ENTRY KiReservedException
|
||||
PROLOG_END KiReservedException
|
||||
|
||||
//
|
||||
// FIXME: TODO
|
||||
//
|
||||
b .
|
||||
|
||||
ENTRY_END KiReservedException
|
||||
|
|
|
@ -80,8 +80,9 @@ KiIdleLoop(VOID)
|
|||
else
|
||||
{
|
||||
//
|
||||
// FIXME-TODO: Wait-For-Interrupt ARM Opcode
|
||||
// Go into WFI (sleep more)
|
||||
//
|
||||
KeArmWaitForInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,10 +156,13 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
|||
if (Prcb->DpcRoutineActive)
|
||||
{
|
||||
//
|
||||
// FIXME-TODO: Implement bugcheck code
|
||||
// Crash the machine
|
||||
//
|
||||
DPRINT1("DPCS ACTIVE!!!\n");
|
||||
ASSERT(FALSE);
|
||||
KeBugCheckEx(ATTEMPTED_SWITCH_FROM_DPC,
|
||||
(ULONG_PTR)OldThread,
|
||||
(ULONG_PTR)NewThread,
|
||||
(ULONG_PTR)OldThread->InitialStack,
|
||||
0);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -167,10 +171,16 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
|||
if (NewThread->ApcState.KernelApcPending)
|
||||
{
|
||||
//
|
||||
// FIXME-TODO: Implement bugcheck code
|
||||
// Are APCs enabled?
|
||||
//
|
||||
DPRINT1("APCs pending!\n");
|
||||
ASSERT(FALSE);
|
||||
if (NewThread->SpecialApcDisable == 0)
|
||||
{
|
||||
//
|
||||
// Request APC delivery
|
||||
//
|
||||
HalRequestSoftwareInterrupt(APC_LEVEL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -517,13 +527,23 @@ KiSoftwareInterruptHandler(IN PKTRAP_FRAME TrapFrame)
|
|||
// Read the opcode
|
||||
//
|
||||
Instruction = *(PULONG)(TrapFrame->Pc - sizeof(ULONG));
|
||||
|
||||
//
|
||||
// FIXME-TODO: Enable interrupts?
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Call the service call dispatcher
|
||||
//
|
||||
KiSystemService(Thread, TrapFrame, Instruction);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
KiUndefinedExceptionHandler(IN PKTRAP_FRAME TrapFrame)
|
||||
{
|
||||
ASSERT(TrapFrame->DbgArgMark == 0xBADB0D00);
|
||||
|
||||
//
|
||||
// This should never happen
|
||||
//
|
||||
DPRINT1("[UNDEF] @ %p/%p\n", TrapFrame->SvcLr, TrapFrame->Pc);
|
||||
UNIMPLEMENTED;
|
||||
ASSERT(FALSE);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,11 @@ KiSystemService(IN PKTHREAD Thread,
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// We can safely enable interrupts here
|
||||
//
|
||||
_enable();
|
||||
|
||||
//
|
||||
// Do the system call and save result in EAX
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue