feat(panic): funMessages in panic
feat(rand): also implemented rand
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <Types.h>
|
||||
#include <Arch/Timer.h>
|
||||
|
||||
enum {
|
||||
kRandSeed = 0x9E3779B97F4A7C15ULL,
|
||||
kRandMultiplier = 0xBF58476D1CE4E5B9ULL,
|
||||
kRandIncrement = 0x94D049BB133111EBULL,
|
||||
};
|
||||
|
||||
static inline UInt64 Rand() {
|
||||
static _Atomic UInt64 sequence = 0;
|
||||
|
||||
UInt64 z = (TimerGetCounter() + kRandSeed + (++sequence));
|
||||
z = (z ^ (z >> 30)) * kRandMultiplier;
|
||||
z = (z ^ (z >> 27)) * kRandIncrement;
|
||||
return z ^ (z >> 31);
|
||||
}
|
||||
@@ -31,7 +31,6 @@ void KernelMain(Bootinfo* bootinfo) {
|
||||
);
|
||||
TimerInitialize();
|
||||
CPUEnableInterrupts();
|
||||
|
||||
SchedulerInitialize();
|
||||
|
||||
OSLog("Kernel initialized.\n");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <OS/Panic.h>
|
||||
#include <OS/Log.h>
|
||||
#include <Arch/CPU.h>
|
||||
#include <Lib/Rand.h>
|
||||
|
||||
static const ASCII* GetExceptionClassString(UInt32 class) {
|
||||
switch (class) {
|
||||
@@ -20,6 +21,24 @@ static const ASCII* GetExceptionClassString(UInt32 class) {
|
||||
}
|
||||
}
|
||||
|
||||
static const ASCII* sFunMessages[] = {
|
||||
"Execution finished abnormally with code: 0x_x",
|
||||
"Ah shit, here we go again",
|
||||
"It's definitely your fault.",
|
||||
"No more Roblox!",
|
||||
"Call your mom 4 help!",
|
||||
"2bad4u",
|
||||
"Touch grass",
|
||||
"Skill issue",
|
||||
"You should just go outside actually",
|
||||
"Perfect opportunity to take a shower",
|
||||
"404 not found",
|
||||
"Windows is locked! Password:___ Time left: 5:45:41",
|
||||
"\"NAM PIZDA\": hackers dropped our registry",
|
||||
"That's all, folks!",
|
||||
"rip",
|
||||
};
|
||||
|
||||
__attribute__((noreturn)) static void Halt() {
|
||||
loop {
|
||||
CPUDisableInterrupts();
|
||||
@@ -36,6 +55,9 @@ static void DrawPanicHeader() {
|
||||
PrintSeparator();
|
||||
OSLog("\tKernel Panic! :(\n");
|
||||
PrintSeparator();
|
||||
UInt64 funMessagesCount = sizeof(sFunMessages) / sizeof(sFunMessages[0]);
|
||||
OSLog("\t%s\n", sFunMessages[Rand() % funMessagesCount]);
|
||||
PrintSeparator();
|
||||
}
|
||||
|
||||
static void DrawPanicFooter() {
|
||||
|
||||
Reference in New Issue
Block a user