ptos: bpal: Add memory map interface

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
2026-07-10 20:16:46 +00:00
parent cbd74a54fb
commit 128060dca0
2 changed files with 56 additions and 1 deletions
+26 -1
View File
@@ -25,7 +25,30 @@ static volatile struct limine_hhdm_request HHDMReq = {
.revision = 0
};
VOID
/* Memory map request */
static struct limine_memmap_response *MapResp = NULL;
static volatile struct limine_memmap_request MapReq = {
.id = LIMINE_MEMMAP_REQUEST_ID,
.revision = 0
};
static PT_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;
}
static VOID
BpalInitFramebuffer(BPAL_HANDLE *Handle)
{
BPAL_FRAMEBUFFER *Framebuffer;
@@ -56,7 +79,9 @@ KeBpalLimineInit(BPAL_HANDLE *Result)
HHDMResp = HHDMReq.response;
FbResp = FbReq.response;
MapResp = MapReq.response;
Result->KernelBase = HHDMResp->offset;
Result->MemEntryIdx = LimineMemEntryIdx;
BpalInitFramebuffer(Result);
}