Files
SystemPaw3/paw/stos/ke/bpal/bpal.c
T
Chloe M. 5c522ffc7f stos: Handle pre BPAL kernel knots
Signed-off-by: Chloe M. <chloe@mensia.org>
2026-06-23 05:47:24 +00:00

59 lines
970 B
C

/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Boot protocol abstraction layer
* Author: Chloe M.
*/
#include <ke/bpal.h>
#include <ke/knot.h>
#include <stdef.h>
#include <string.h>
#ifndef _BOOT_PROTO
#error "Boot protocol must be defined"
#else
#define BOOT_PROTO _BOOT_PROTO
#endif /* !_BOOT_PROTO */
static BPAL_HANDLE BpalHandle;
static BOOLEAN IsInit = false;
VOID
KeBpalGetHandle(BPAL_HANDLE *Result)
{
if (Result == NULL) {
return;
}
*Result = BpalHandle;
}
BOOLEAN
KeBpalIsInit(VOID)
{
return IsInit;
}
VOID
KeBpalInit(VOID)
{
const CHAR *BootProto = BOOT_PROTO;
switch (*BootProto) {
case 'l':
if (RtlMemCmp(BootProto, "limine", 6) == 0) {
KeBpalLimineInit(&BpalHandle);
IsInit = true;
return;
}
}
KeKnot(
KNOT_BAD_BOOT_PROTO,
"got bad boot protocol '%s'\n",
BootProto
);
}