diff --git a/Kernel/Include/Lib/Rand.h b/Kernel/Include/Lib/Rand.h new file mode 100644 index 0000000..93b11af --- /dev/null +++ b/Kernel/Include/Lib/Rand.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include + +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); +} diff --git a/Kernel/Source/KernelMain.c b/Kernel/Source/KernelMain.c index e72433e..a94658e 100644 --- a/Kernel/Source/KernelMain.c +++ b/Kernel/Source/KernelMain.c @@ -31,7 +31,6 @@ void KernelMain(Bootinfo* bootinfo) { ); TimerInitialize(); CPUEnableInterrupts(); - SchedulerInitialize(); OSLog("Kernel initialized.\n"); diff --git a/Kernel/Source/OS/Panic.c b/Kernel/Source/OS/Panic.c index 4d962da..51140a7 100644 --- a/Kernel/Source/OS/Panic.c +++ b/Kernel/Source/OS/Panic.c @@ -1,6 +1,7 @@ #include #include #include +#include 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() {