From 8b90c1f407b4f4aa3802858e23aa90d7dfbe17ad Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Thu, 11 Apr 2024 20:58:38 +0200 Subject: bootinfo struct --- stage3/gfx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'stage3/gfx.c') diff --git a/stage3/gfx.c b/stage3/gfx.c index 7fe8df7..4c9fe4c 100644 --- a/stage3/gfx.c +++ b/stage3/gfx.c @@ -1,7 +1,6 @@ #include "gfx.h" #include "memory.h" - -struct GfxInfo *gfx_info = (void *) (0x1000-10); +#include "bootinfo.h" // byteswap u32 make_color(color col) @@ -15,17 +14,17 @@ u32 make_color(color col) void gfx_set_pixel(u16 x, u16 y, u32 col) { - u32 *out = (u32 *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof col); + u32 *out = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof col; *out = col; BARRIER_VAR(out); } void gfx_set_area(u16 x, u16 y, u16 w, u16 h, u32 col) { - void *cbeg = (void *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof col); - void *cend = cbeg + h * gfx_info->pitch; + void *cbeg = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof col; + void *cend = cbeg + h * bootinfo->gfx_pitch; - for (; cbeg < cend; cbeg += gfx_info->pitch) { + for (; cbeg < cend; cbeg += bootinfo->gfx_pitch) { u32 *rbeg = cbeg; u32 *rend = rbeg + w; @@ -38,8 +37,8 @@ void gfx_set_area(u16 x, u16 y, u16 w, u16 h, u32 col) void gfx_draw_img(u16 x, u16 y, u16 w, u16 h, u32 *img) { - void *cbeg = (void *) (u64) (gfx_info->framebuffer + y * gfx_info->pitch + x * sizeof(color)); - for (u16 yi = 0; yi < h; cbeg += gfx_info->pitch, yi++) + void *cbeg = bootinfo->gfx_framebuffer + y * bootinfo->gfx_pitch + x * sizeof(color); + for (u16 yi = 0; yi < h; cbeg += bootinfo->gfx_pitch, yi++) lmemcpy(cbeg, img + yi * w, w * sizeof(color)); BARRIER_VAR(cbeg); -- cgit v1.2.3