Begin attempt to get limine framebuffer and combine it into kernel data members. TODO: update SYS_KERNEL DU members.

This commit is contained in:
TomAwezome 2022-08-20 11:46:30 -04:00
parent a1ef3f7566
commit ddccc7d7ff
2 changed files with 29 additions and 0 deletions

View file

@ -544,6 +544,25 @@ class CVBEModeShort
U32 max_pixel_clock; //TODO refresh rates.
};
class CLimineFramebuffer
{
U8 *address;
U64 width,
height,
pitch;
U16 bpp;
U8 memory_model,
red_mask_size,
red_mask_shift,
green_mask_size,
green_mask_shift,
blue_mask_size,
blue_mask_shift,
unused[7];
U64 edid_size;
U8 *edid;
};
#help_index "Boot"
class CKernel
{//Must match $LK,"OSStartUp",A="FF:::/Kernel/KStart16.ZC,MEM_BOOT_BASE"$
@ -565,6 +584,7 @@ class CKernel
;$$ = ($$ + 15) & -16;
CGDT sys_gdt;
U32 sys_font_ptr;
CLimineFramebuffer limine_framebuffer;
CVBEInfo sys_vbe_info;
CVBEModeShort sys_vbe_modes[VBE_MODES_NUM];
CVBEMode sys_vbe_mode;

View file

@ -18,6 +18,11 @@ static volatile struct limine_memmap_request memmap_request = {
.revision = 0
};
static volatile struct limine_framebuffer_request framebuffer_request = {
.id = LIMINE_FRAMEBUFFER_REQUEST,
.revision = 0
};
#define MEM_E820_ENTRIES_NUM 48
#define MEM_E820T_USABLE 1
@ -93,6 +98,7 @@ struct CKernel {
uint16_t sys_pci_buses;
struct CGDT sys_gdt;
uint32_t sys_font_ptr;
struct limine_framebuffer limine_fb;
} __attribute__((packed));
#define BOOT_SRC_RAM 2
@ -195,6 +201,9 @@ void _start(void) {
CKernel->mem_E820[i].type = our_type;
}
struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0];
memcpy(&CKernel->limine_fb, framebuffer, sizeof(struct limine_framebuffer));
void *target_addr = (void *)lower - kernel_address_request.response->virtual_base;
target_addr += kernel_address_request.response->physical_base;