stos: bpal: Add memory map callbacks

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-22 03:51:35 +00:00
parent c317ed8a4d
commit e9a1de69cf
2 changed files with 56 additions and 0 deletions
+25
View File
@@ -43,6 +43,13 @@ static struct limine_bootloader_performance_request LoaderPerReq = {
.revision = 0
};
/* Memory map request */
static struct limine_memmap_response *MapResp = NULL;
static volatile struct limine_memmap_request MapReq = {
.id = LIMINE_MEMMAP_REQUEST_ID,
.revision = 0
};
VOID
BpalInitFramebuffer(BPAL_HANDLE *Handle)
{
@@ -65,6 +72,22 @@ BpalInitFramebuffer(BPAL_HANDLE *Handle)
Framebuffer->BlueMaskShift = FRAMEBUFFER->blue_mask_shift;
}
static ST_STATUS
LimineMemEntryIdx(USIZE Idx, MEMMAP_ENTRY *Result)
{
struct limine_memmap_entry *Entry;
if (Idx >= MapResp->entry_count) {
return STATUS_NOT_FOUND;
}
Entry = MapResp->entries[Idx];
Result->Base = Entry->base;
Result->Length = Entry->length;
Result->Type = Entry->type;
return STATUS_SUCCESS;
}
VOID
KeBpalLimineInit(BPAL_HANDLE *Handle)
{
@@ -72,6 +95,7 @@ KeBpalLimineInit(BPAL_HANDLE *Handle)
LoaderPerfResp = LoaderPerReq.response;
HHDMResp = HHDMReq.response;
FbResp = FbReq.response;
MapResp = MapReq.response;
DTRACE(
"slut handed control by %s %s\n",
@@ -91,4 +115,5 @@ KeBpalLimineInit(BPAL_HANDLE *Handle)
BpalInitFramebuffer(Handle);
Handle->KernelBase = HHDMResp->offset;
Handle->MemEntryIdx = LimineMemEntryIdx;
}