diff --git a/common/limine.h b/common/limine.h index dbc7e2d5..bd6d6fb2 100644 --- a/common/limine.h +++ b/common/limine.h @@ -67,30 +67,24 @@ struct limine_hhdm_request { #define LIMINE_FRAMEBUFFER_RGB 1 -struct limine_framebuffer { - LIMINE_PTR(void *) address; - uint16_t width; - uint16_t height; - uint16_t pitch; - uint16_t bpp; - uint8_t memory_model; - uint8_t red_mask_size; - uint8_t red_mask_shift; - uint8_t green_mask_size; - uint8_t green_mask_shift; - uint8_t blue_mask_size; - uint8_t blue_mask_shift; - uint8_t unused; - uint64_t edid_size; - LIMINE_PTR(void *) edid; - uint8_t reserved[256]; -}; - struct limine_framebuffer_response { uint64_t flags; - uint64_t fbs_count; - LIMINE_PTR(struct limine_framebuffer *) fbs; + uint64_t fb_count; + LIMINE_PTR(LIMINE_PTR(void *) *) fb_address; + LIMINE_PTR(uint16_t *) fb_width; + LIMINE_PTR(uint16_t *) fb_height; + LIMINE_PTR(uint16_t *) fb_pitch; + LIMINE_PTR(uint16_t *) fb_bpp; + LIMINE_PTR(uint8_t *) fb_memory_model; + LIMINE_PTR(uint8_t *) fb_red_mask_size; + LIMINE_PTR(uint8_t *) fb_red_mask_shift; + LIMINE_PTR(uint8_t *) fb_green_mask_size; + LIMINE_PTR(uint8_t *) fb_green_mask_shift; + LIMINE_PTR(uint8_t *) fb_blue_mask_size; + LIMINE_PTR(uint8_t *) fb_blue_mask_shift; + LIMINE_PTR(uint64_t *) fb_edid_size; + LIMINE_PTR(LIMINE_PTR(void *) *) fb_edid; }; struct limine_framebuffer_request { diff --git a/common/protos/limine.c b/common/protos/limine.c index 74c89e58..db1b73cb 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -402,28 +402,56 @@ FEAT_START ext_mem_alloc(sizeof(struct limine_framebuffer_response)); // For now we only support 1 framebuffer - struct limine_framebuffer *fbp = ext_mem_alloc(sizeof(struct limine_framebuffer)); - framebuffer_response->fbs = reported_addr(fbp); - framebuffer_response->fbs_count = 1; + size_t fb_count = 1; + uint64_t *fb_address = ext_mem_alloc(sizeof(uint64_t) * fb_count); + uint16_t *fb_width = ext_mem_alloc(sizeof(uint16_t) * fb_count); + uint16_t *fb_height = ext_mem_alloc(sizeof(uint16_t) * fb_count); + uint16_t *fb_pitch = ext_mem_alloc(sizeof(uint16_t) * fb_count); + uint16_t *fb_bpp = ext_mem_alloc(sizeof(uint16_t) * fb_count); + uint8_t *fb_memory_model = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_red_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_red_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_green_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_green_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_blue_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint8_t *fb_blue_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); + uint64_t *fb_edid_size = ext_mem_alloc(sizeof(uint64_t) * fb_count); + uint64_t *fb_edid = ext_mem_alloc(sizeof(uint64_t) * fb_count); + + framebuffer_response->fb_count = fb_count; + framebuffer_response->fb_address = reported_addr(fb_address); + framebuffer_response->fb_width = reported_addr(fb_width); + framebuffer_response->fb_height = reported_addr(fb_height); + framebuffer_response->fb_pitch = reported_addr(fb_pitch); + framebuffer_response->fb_bpp = reported_addr(fb_bpp); + framebuffer_response->fb_memory_model = reported_addr(fb_memory_model); + framebuffer_response->fb_red_mask_size = reported_addr(fb_red_mask_size); + framebuffer_response->fb_red_mask_shift = reported_addr(fb_red_mask_shift); + framebuffer_response->fb_green_mask_size = reported_addr(fb_green_mask_size); + framebuffer_response->fb_green_mask_shift = reported_addr(fb_green_mask_shift); + framebuffer_response->fb_blue_mask_size = reported_addr(fb_blue_mask_size); + framebuffer_response->fb_blue_mask_shift = reported_addr(fb_blue_mask_shift); + framebuffer_response->fb_edid_size = reported_addr(fb_edid_size); + framebuffer_response->fb_edid = reported_addr(fb_edid); struct edid_info_struct *edid_info = get_edid_info(); if (edid_info != NULL) { - fbp->edid_size = sizeof(struct edid_info_struct); - fbp->edid = reported_addr(edid_info); + *fb_edid_size = sizeof(struct edid_info_struct); + *fb_edid = reported_addr(edid_info); } - fbp->memory_model = LIMINE_FRAMEBUFFER_RGB; - fbp->address = reported_addr((void *)(uintptr_t)fb.framebuffer_addr); - fbp->width = fb.framebuffer_width; - fbp->height = fb.framebuffer_height; - fbp->bpp = fb.framebuffer_bpp; - fbp->pitch = fb.framebuffer_pitch; - fbp->red_mask_size = fb.red_mask_size; - fbp->red_mask_shift = fb.red_mask_shift; - fbp->green_mask_size = fb.green_mask_size; - fbp->green_mask_shift = fb.green_mask_shift; - fbp->blue_mask_size = fb.blue_mask_size; - fbp->blue_mask_shift = fb.blue_mask_shift; + *fb_memory_model = LIMINE_FRAMEBUFFER_RGB; + *fb_address = reported_addr((void *)(uintptr_t)fb.framebuffer_addr); + *fb_width = fb.framebuffer_width; + *fb_height = fb.framebuffer_height; + *fb_bpp = fb.framebuffer_bpp; + *fb_pitch = fb.framebuffer_pitch; + *fb_red_mask_size = fb.red_mask_size; + *fb_red_mask_shift = fb.red_mask_shift; + *fb_green_mask_size = fb.green_mask_size; + *fb_green_mask_shift = fb.green_mask_shift; + *fb_blue_mask_size = fb.blue_mask_size; + *fb_blue_mask_shift = fb.blue_mask_shift; framebuffer_request->response = reported_addr(framebuffer_response); FEAT_END diff --git a/test/limine.c b/test/limine.c index 6f8dd00b..962a6b9e 100644 --- a/test/limine.c +++ b/test/limine.c @@ -155,23 +155,22 @@ FEAT_START } e9_printf(""); struct limine_framebuffer_response *fb_response = framebuffer_request.response; - e9_printf("%d framebuffer(s)", fb_response->fbs_count); - for (size_t i = 0; i < fb_response->fbs_count; i++) { - struct limine_framebuffer *fb = &fb_response->fbs[i]; - e9_printf("Address: %x", fb->address); - e9_printf("Width: %d", fb->width); - e9_printf("Height: %d", fb->height); - e9_printf("Pitch: %d", fb->pitch); - e9_printf("BPP: %d", fb->bpp); - e9_printf("Memory model: %d", fb->memory_model); - e9_printf("Red mask size: %d", fb->red_mask_size); - e9_printf("Red mask shift: %d", fb->red_mask_shift); - e9_printf("Green mask size: %d", fb->green_mask_size); - e9_printf("Green mask shift: %d", fb->green_mask_shift); - e9_printf("Blue mask size: %d", fb->blue_mask_size); - e9_printf("Blue mask shift: %d", fb->blue_mask_shift); - e9_printf("EDID size: %d", fb->edid_size); - e9_printf("EDID at: %x", fb->edid); + e9_printf("%d framebuffer(s)", fb_response->fb_count); + for (size_t i = 0; i < fb_response->fb_count; i++) { + e9_printf("Address: %x", fb_response->fb_address[i]); + e9_printf("Width: %d", fb_response->fb_width[i]); + e9_printf("Height: %d", fb_response->fb_height[i]); + e9_printf("Pitch: %d", fb_response->fb_pitch[i]); + e9_printf("BPP: %d", fb_response->fb_bpp[i]); + e9_printf("Memory model: %d", fb_response->fb_memory_model[i]); + e9_printf("Red mask size: %d", fb_response->fb_red_mask_size[i]); + e9_printf("Red mask shift: %d", fb_response->fb_red_mask_shift[i]); + e9_printf("Green mask size: %d", fb_response->fb_green_mask_size[i]); + e9_printf("Green mask shift: %d", fb_response->fb_green_mask_shift[i]); + e9_printf("Blue mask size: %d", fb_response->fb_blue_mask_size[i]); + e9_printf("Blue mask shift: %d", fb_response->fb_blue_mask_shift[i]); + e9_printf("EDID size: %d", fb_response->fb_edid_size[i]); + e9_printf("EDID at: %x", fb_response->fb_edid[i]); } FEAT_END