From b96c27bba0b242fc860fc9a2fcb63f121312fa7e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 20 Mar 2021 19:52:56 +0100 Subject: LGTM! --- kernel/drivers/fb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'kernel/drivers') diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c index af8a830..2db05f2 100644 --- a/kernel/drivers/fb.c +++ b/kernel/drivers/fb.c @@ -33,11 +33,8 @@ static s32 fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct devi 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); + fb_map_buffer(proc_current()->page_dir, info); return 0; } default: @@ -50,6 +47,13 @@ static s32 fb_ready(void) return 1; } +void fb_map_buffer(struct page_dir *dir, struct vid_info *boot) +{ + struct vbe_basic *vbe = (struct vbe_basic *)boot->vbe; + u32 size = vbe->height * vbe->pitch; + memory_map_identity(dir, memory_range_around((u32)vbe->fb, size), MEMORY_USER); +} + void fb_install(struct vid_info *boot) { info = boot; -- cgit v1.2.3