stos: Add kernel knotting impl
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
.SILENT:
|
||||
include ../../mk/stos.mk
|
||||
|
||||
CFILES = $(shell find ../init -name "*.c")
|
||||
CFILES = $(shell ls)
|
||||
CFILES += $(shell find ../init -name "*.c")
|
||||
CFILES += $(shell find ../xt -name "*.c")
|
||||
CFILES += $(shell find ../lib -name "*.c")
|
||||
CFILES += $(shell find ../drivers -name "*.c")
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe M.
|
||||
* Provided under the BSD-3 clause.
|
||||
*
|
||||
* Description: Fucks and knots the kernel
|
||||
* Author: Chloe M.
|
||||
*/
|
||||
|
||||
#include <drivers/bootvid/fbio.h>
|
||||
#include <ex/trace.h>
|
||||
#include <ke/knot.h>
|
||||
|
||||
#define KNOT_REASON(Reason) \
|
||||
((Reason) >= NELEM(ReasonTable)) \
|
||||
? ReasonTable[0] \
|
||||
: ReasonTable[(Reason)]
|
||||
|
||||
/* Reason lookup table */
|
||||
static const CHAR *ReasonTable[] = {
|
||||
[KNOT_MISC] = "unspecified reason",
|
||||
[KNOT_UNBOUND_RSRC] = "unbounded resource"
|
||||
};
|
||||
|
||||
/* Globals */
|
||||
static CHAR KnotBuf[256];
|
||||
static va_list Ap;
|
||||
static BOOTCONS_ATTR KnotAttr = {
|
||||
.Background = 0x000080,
|
||||
.Foreground = 0xFFFFFF
|
||||
};
|
||||
|
||||
static CHAR KnotMessage[] = {
|
||||
"SystemPaw DR has ran into a wittle issue and the kernel pilot kitty\n"
|
||||
"has suspended the CPU to prevent damage to your machine.\n\n"
|
||||
"Press and hold the power button until the screen blanks.\n\n"
|
||||
};
|
||||
|
||||
VOID
|
||||
KiKnot(KNOT_REASON Reason, const CHAR *Fmt, ...)
|
||||
{
|
||||
va_start(Ap, Fmt);
|
||||
FmtPrintf(KnotBuf, sizeof(KnotBuf), Fmt, Ap);
|
||||
BootVidInitCons(&KnotAttr);
|
||||
|
||||
TRACE("\033[H\033[2J");
|
||||
TRACE(KnotMessage);
|
||||
TRACE("knot: %s", KnotBuf);
|
||||
TRACE("reason: %s\n", KNOT_REASON(Reason));
|
||||
}
|
||||
Reference in New Issue
Block a user