blob: 4318b9cda97687ceb18f82dc9b1b4dc89c226b79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* ========================================
Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
======================================== */
#include <KernelKit/HeapMgr.h>
#include <KernelKit/KPC.h>
#include <NeKit/KernelPanic.h>
namespace Kernel {
STATIC Bool kRaiseOnBugCheck = false;
/// @brief Does a system wide bug check.
/// @param void no params are needed.
/// @return if error-free: false, otherwise true.
Boolean err_bug_check_raise(Void) noexcept {
Char* ptr = new Char[512];
if (ptr == nullptr) goto bug_check_fail;
if (!mm_is_valid_ptr(ptr)) goto bug_check_fail;
delete[] ptr;
return Yes;
bug_check_fail:
if (ptr) delete[] ptr;
ptr = nullptr;
if (kRaiseOnBugCheck) {
ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR);
}
return No;
}
} // namespace Kernel
|