From 8176351e1a3d1598bedbc007897d530475942275 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 13 Mar 2021 13:33:26 +0100 Subject: Nicü --- kernel/drivers/fb.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'kernel/drivers') diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c index a1a7729..8e73f5b 100644 --- a/kernel/drivers/fb.c +++ b/kernel/drivers/fb.c @@ -1,13 +1,25 @@ // MIT License, Copyright (c) 2021 Marvin Borner +#include #include #include #include #include #include +#include #include #include +struct vbe_basic { + u8 stuff1[16]; + u16 pitch; + u16 width; + u16 height; + u8 stuff2[18]; + u8 *fb; + u8 stuff3[212]; +}; + static u32 dev_id = 0; static struct vid_info *info = NULL; @@ -18,9 +30,16 @@ static s32 fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct devi UNUSED(dev); switch (request) { - case IO_FB_GET: - memcpy(arg1, info->vbe, 256); + case IO_FB_GET: { + if (!info) + return -1; + struct vbe_basic *vbe = (struct vbe_basic *)info->vbe; + memcpy(arg1, info->vbe, sizeof(struct vbe_basic)); + u32 size = vbe->height * vbe->pitch; + memory_map_identity(proc_current()->page_dir, + memory_range_around((u32)vbe->fb, size), MEMORY_USER); return 0; + } default: return -1; } -- cgit v1.2.3