Files
SystemPaw3/paw/stos/ke/bpal/proto/limine.c
T
Chloe M. bb6e4d98d1 stos: bpal: Initialize BPAL handle
Signed-off-by: Chloe M. <chloe@mensia.org>
2026-06-22 02:25:27 +00:00

62 lines
1.4 KiB
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 <ex/trace.h>
#include <lib/limine.h>
#define DTRACE(Fmt, ...) \
TRACE("[ BPAL ]: " Fmt, ##__VA_ARGS__)
/* HHDM request */
static struct limine_hhdm_response *HHDMResp = NULL;
static volatile struct limine_hhdm_request HHDMReq = {
.id = LIMINE_HHDM_REQUEST_ID,
.revision = 0
};
/* Bootloader information */
static struct limine_bootloader_info_response *LoaderInfoResp = NULL;
static volatile struct limine_bootloader_info_request LoaderInfoReq = {
.id = LIMINE_BOOTLOADER_INFO_REQUEST_ID,
.revision = 0
};
/* Bootloader perf information */
static struct limine_bootloader_performance_response *LoaderPerfResp = NULL;
static struct limine_bootloader_performance_request LoaderPerReq = {
.id = LIMINE_BOOTLOADER_PERFORMANCE_REQUEST_ID,
.revision = 0
};
VOID
KeBpalLimineInit(BPAL_HANDLE *Handle)
{
LoaderInfoResp = LoaderInfoReq.response;
LoaderPerfResp = LoaderPerReq.response;
HHDMResp = HHDMReq.response;
DTRACE(
"slut handed control by %s %s\n",
LoaderInfoResp->name,
LoaderInfoResp->version
);
DTRACE(
"loader took %d usec\n",
LoaderPerfResp->init_usec
);
DTRACE(
"handoff took %d usec\n",
LoaderPerfResp->exec_usec
);
Handle->KernelBase = HHDMResp->offset;
}