Files
PluralTechnology/service/ptos/ke/bpal/proto/limine.c
T
2026-07-10 06:29:52 +00:00

63 lines
1.5 KiB
C

/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Limine backend
* Author: Chloe M.
*/
#include <ke/bpal.h>
#include <lib/limine.h>
#define FRAMEBUFFER FbResp->framebuffers[0]
/* Framebuffer request */
static struct limine_framebuffer_response *FbResp = NULL;
static struct limine_framebuffer_request FbReq = {
.id = LIMINE_FRAMEBUFFER_REQUEST_ID,
.revision = 0
};
/* HHDM request */
static struct limine_hhdm_response *HHDMResp = NULL;
static volatile struct limine_hhdm_request HHDMReq = {
.id = LIMINE_HHDM_REQUEST_ID,
.revision = 0
};
VOID
BpalInitFramebuffer(BPAL_HANDLE *Handle)
{
BPAL_FRAMEBUFFER *Framebuffer;
if (Handle == NULL) {
return;
}
Framebuffer = &Handle->Framebuffer;
Framebuffer->Address = FRAMEBUFFER->address;
Framebuffer->Width = FRAMEBUFFER->width;
Framebuffer->Height = FRAMEBUFFER->height;
Framebuffer->Pitch = FRAMEBUFFER->pitch;
Framebuffer->RedMaskSize = FRAMEBUFFER->red_mask_size;
Framebuffer->RedMaskShift = FRAMEBUFFER->red_mask_shift;
Framebuffer->GreenMaskSize = FRAMEBUFFER->green_mask_size;
Framebuffer->GreenMaskShift = FRAMEBUFFER->green_mask_shift;
Framebuffer->BlueMaskSize = FRAMEBUFFER->blue_mask_size;
Framebuffer->BlueMaskShift = FRAMEBUFFER->blue_mask_shift;
}
VOID
KeBpalLimineInit(BPAL_HANDLE *Result)
{
if (Result == NULL) {
return;
}
HHDMResp = HHDMReq.response;
FbResp = FbReq.response;
Result->KernelBase = HHDMResp->offset;
BpalInitFramebuffer(Result);
}