ptos: bpal: Add memory map interface
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user