stos: bpal: Initialize BPAL handle

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-22 02:25:27 +00:00
parent f546599d18
commit bb6e4d98d1
3 changed files with 32 additions and 3 deletions
+8 -1
View File
@@ -25,7 +25,14 @@ typedef struct {
*/ */
VOID KeBpalInit(VOID); VOID KeBpalInit(VOID);
/*
* Obtain the boot protocol handle
*
* @Result: Result is written here
*/
VOID KeBpalGetHandle(BPAL_HANDLE *Result);
/* Backend init functions */ /* Backend init functions */
VOID KeBpalLimineInit(VOID); VOID KeBpalLimineInit(BPAL_HANDLE *Handle);
#endif /* !_KE_BPAL_H_ */ #endif /* !_KE_BPAL_H_ */
+13 -1
View File
@@ -16,6 +16,18 @@
#define BOOT_PROTO _BOOT_PROTO #define BOOT_PROTO _BOOT_PROTO
#endif /* !_BOOT_PROTO */ #endif /* !_BOOT_PROTO */
static BPAL_HANDLE BpalHandle;
VOID
KeBpalGetHandle(BPAL_HANDLE *Result)
{
if (Result == NULL) {
return;
}
*Result = BpalHandle;
}
VOID VOID
KeBpalInit(VOID) KeBpalInit(VOID)
{ {
@@ -24,7 +36,7 @@ KeBpalInit(VOID)
switch (*BootProto) { switch (*BootProto) {
case 'l': case 'l':
if (RtlMemCmp(BootProto, "limine", 6) == 0) { if (RtlMemCmp(BootProto, "limine", 6) == 0) {
KeBpalLimineInit(); KeBpalLimineInit(&BpalHandle);
return; return;
} }
} }
+11 -1
View File
@@ -13,6 +13,13 @@
#define DTRACE(Fmt, ...) \ #define DTRACE(Fmt, ...) \
TRACE("[ BPAL ]: " Fmt, ##__VA_ARGS__) 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 */ /* Bootloader information */
static struct limine_bootloader_info_response *LoaderInfoResp = NULL; static struct limine_bootloader_info_response *LoaderInfoResp = NULL;
static volatile struct limine_bootloader_info_request LoaderInfoReq = { static volatile struct limine_bootloader_info_request LoaderInfoReq = {
@@ -28,10 +35,11 @@ static struct limine_bootloader_performance_request LoaderPerReq = {
}; };
VOID VOID
KeBpalLimineInit(VOID) KeBpalLimineInit(BPAL_HANDLE *Handle)
{ {
LoaderInfoResp = LoaderInfoReq.response; LoaderInfoResp = LoaderInfoReq.response;
LoaderPerfResp = LoaderPerReq.response; LoaderPerfResp = LoaderPerReq.response;
HHDMResp = HHDMReq.response;
DTRACE( DTRACE(
"slut handed control by %s %s\n", "slut handed control by %s %s\n",
@@ -48,4 +56,6 @@ KeBpalLimineInit(VOID)
"handoff took %d usec\n", "handoff took %d usec\n",
LoaderPerfResp->exec_usec LoaderPerfResp->exec_usec
); );
Handle->KernelBase = HHDMResp->offset;
} }