From ddccc7d7ff81003287b4aa0eb819b4fc33a2c8df Mon Sep 17 00:00:00 2001 From: TomAwezome Date: Sat, 20 Aug 2022 11:46:30 -0400 Subject: [PATCH] Begin attempt to get limine framebuffer and combine it into kernel data members. TODO: update SYS_KERNEL DU members. --- src/Kernel/KernelA.HH | 20 ++++++++++++++++++++ zealbooter/zealbooter.c | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/src/Kernel/KernelA.HH b/src/Kernel/KernelA.HH index 2729c8f3..56c565b4 100755 --- a/src/Kernel/KernelA.HH +++ b/src/Kernel/KernelA.HH @@ -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; diff --git a/zealbooter/zealbooter.c b/zealbooter/zealbooter.c index f67bf09e..fd029240 100644 --- a/zealbooter/zealbooter.c +++ b/zealbooter/zealbooter.c @@ -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;