diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-26 00:10:41 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-26 02:29:25 +0430 |
commit | 6b606771b53c6547eaed13fa251f68d76180eae8 (patch) | |
tree | 18ff70b4b75c9b63d8ef1c32b89e60b3b83ad4aa /Kernel/Panic.cpp | |
parent | 466e2a2fb73a5933892ac17a95f0e96bd4269bad (diff) | |
download | serenity-6b606771b53c6547eaed13fa251f68d76180eae8.zip |
Kernel: Reset on panic in self-test mode
This makes a kernel panic immediately fail the on-target CI job.
Otherwise the failed job looks like a test timeout unless one digs into
the details of the job.
Diffstat (limited to 'Kernel/Panic.cpp')
-rw-r--r-- | Kernel/Panic.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Kernel/Panic.cpp b/Kernel/Panic.cpp index d1cb615973..5e754b7c32 100644 --- a/Kernel/Panic.cpp +++ b/Kernel/Panic.cpp @@ -6,16 +6,29 @@ #include <AK/Format.h> #include <Kernel/Arch/x86/Processor.h> +#include <Kernel/CommandLine.h> #include <Kernel/KSyms.h> #include <Kernel/Panic.h> namespace Kernel { +[[noreturn]] static void __reset() +{ + // FIXME: This works for i686/x86_64, but needs to be ported to any other arch when needed. + asm( + "lidt 0\n" + "movl $0, 0\n"); + + __builtin_unreachable(); +} + void __panic(const char* file, unsigned int line, const char* function) { critical_dmesgln("at {}:{} in {}", file, line, function); dump_backtrace(); - Processor::halt(); + if (kernel_command_line().boot_mode() == BootMode::SelfTest) + __reset(); + else + Processor::halt(); } - } |