1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 04:35:07 +00:00
serenity/Kernel/Arch/x86/common/CPU.cpp
Timon Kruiper a47271ebdc Kernel: Move PAGE_MASK define to the shared CPU.h header
These are the same for both x86 and aarch64 for now. Also update some
include paths to use the generic CPU.h header.
2022-10-26 20:01:45 +02:00

42 lines
1 KiB
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Assertions.h>
#include <Kernel/Arch/CPU.h>
#include <Kernel/Panic.h>
#include <Kernel/Process.h>
using namespace Kernel;
void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func)
{
asm volatile("cli");
critical_dmesgln("ASSERTION FAILED: {}", msg);
critical_dmesgln("{}:{} in {}", file, line, func);
abort();
}
[[noreturn]] void abort()
{
// Avoid lock ranking checks on crashing paths, just try to get some debugging messages out.
auto thread = Thread::current();
if (thread)
thread->set_crashing();
// Switch back to the current process's page tables if there are any.
// Otherwise stack walking will be a disaster.
if (Process::has_current())
Memory::MemoryManager::enter_process_address_space(Process::current());
PANIC("Aborted");
}
[[noreturn]] void _abort()
{
asm volatile("ud2");
__builtin_unreachable();
}