Files
exectos/xtoskrnl/ke/crash.cc
Aiken Harris 4947f788d5
Some checks failed
Builds / ExectOS (amd64, debug) (push) Failing after 23s
Builds / ExectOS (amd64, release) (push) Failing after 27s
Builds / ExectOS (i686, debug) (push) Failing after 21s
Builds / ExectOS (i686, release) (push) Failing after 25s
Migrate KE subsystem to C++
2025-09-09 23:20:50 +02:00

107 lines
2.1 KiB
C++

/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/ke/panic.cc
* DESCRIPTION: System shutdown and kernel panic mechanism
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtos.hh>
/* Kernel Library */
namespace KE
{
/**
* Halts the system.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
Crash::HaltSystem(VOID)
{
/* Enter infinite loop */
for(;;)
{
/* Halt system */
AR::CpuFunc::ClearInterruptFlag();
AR::CpuFunc::Halt();
}
}
/**
* Crashes the system upon detecting a fatal error in which either it is unable to recover or continue to run system.
*
* @param Code
* Specifies the reason for the kernel panic.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
Crash::Panic(IN ULONG Code)
{
PanicEx(Code, 0, 0, 0, 0);
}
/**
* Crashes the system upon detecting a fatal error in which either it is unable to recover or continue to run system.
*
* @param Code
* Specifies the reason for the kernel panic.
*
* @param Parameter1
* Supplies additional information about the kernel panic.
*
* @param Parameter2
* Supplies additional information about the kernel panic.
*
* @param Parameter3
* Supplies additional information about the kernel panic.
*
* @param Parameter4
* Supplies additional information about the kernel panic.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
Crash::PanicEx(IN ULONG Code,
IN ULONG_PTR Parameter1,
IN ULONG_PTR Parameter2,
IN ULONG_PTR Parameter3,
IN ULONG_PTR Parameter4)
{
KdPrint(L"Fatal System Error: 0x%08lx\nKernel Panic!\n\n", Code);
HaltSystem();
}
} /* namespace */
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
XTCLINK
XTAPI
VOID
KeHaltSystem(VOID)
{
KE::Crash::HaltSystem();
}
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
XTCLINK
XTAPI
VOID
KePanic(ULONG Code)
{
KE::Crash::Panic(Code);
}