hw: add kernel panic function to x86_64

Add a kernel panic function to x86_64 that mirrors the functionality
available for ARM.

Issue #5128
This commit is contained in:
Benjamin Lamowski 2024-05-07 15:52:44 +02:00 committed by Christian Helmuth
parent 5049f03f5b
commit dbd070b815

View File

@ -0,0 +1,34 @@
/*
* \brief x86 kernel panic
* \author Benjamin Lamowski
* \date 2024-02-28
*/
/*
* Copyright (C) 2024 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__X86_64__KERNEL__PANIC_H_
#define _CORE__SPEC__X86_64__KERNEL__PANIC_H_
/* base includes */
#include <base/log.h>
namespace Kernel {
template <typename... ARGS>
inline void panic(ARGS &&... args)
{
Genode::error("Kernel panic: ", args...);
/* This is CPU local, but should be sufficient for now. */
asm volatile(
"cli;"
"hlt;"
: : :
);
}
}
#endif /* _CORE__SPEC__X86_64__KERNEL__PANIC_H_ */