Skip to content

Commit

Permalink
hw: add kernel panic function to x86_64
Browse files Browse the repository at this point in the history
Add a kernel panic function to x86_64 that mirrors the functionality
available for ARM.

Issue #5128
  • Loading branch information
atopia authored and chelmuth committed May 15, 2024
1 parent f7f9ad5 commit 0e3aba1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions repos/base-hw/src/core/spec/x86_64/kernel/panic.h
Original file line number Diff line number Diff line change
@@ -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_ */

0 comments on commit 0e3aba1

Please sign in to comment.