From b909a5f963e22b8b476647ad1deb74182b341f40 Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Sat, 16 Dec 2023 00:13:37 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=82=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D1=83=D1=89=D0=B5=D0=B3=D0=BE=20=D1=84=D1=80?= =?UTF-8?q?=D0=B5=D0=B9=D0=BC=D0=B1=D1=83=D1=84=D1=84=D0=B5=D1=80=D0=B0=20?= =?UTF-8?q?=D1=8F=D0=B4=D1=80=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/sys.h | 2 +- kernel/sys.c | 13 +++++++++++-- modlib/types.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/sys.h b/include/sys.h index d3d7f60..bc49c0a 100644 --- a/include/sys.h +++ b/include/sys.h @@ -64,7 +64,7 @@ typedef struct { typedef struct { uint64_t offset; void (*fb_printf)(char *str, ...); // Временная функция - framebuffer_t *(*alloc_framebuffer)( ); + framebuffer_t (*alloc_framebuffer)( ); void (*free_framebuffer)(framebuffer_t *frame); void *(*alloc)(uint64_t size); void (*free)(void *ptr); diff --git a/kernel/sys.c b/kernel/sys.c index ef0428b..e8670a9 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -12,11 +12,20 @@ #include module_info_t *current_module; +extern uint32_t *fb_addr; +extern uint32_t text_color; +extern uint32_t background; +extern uint64_t width; +extern uint64_t height; +extern uint64_t pitch; +extern uint16_t bpp; void sys_init( ) {} -static framebuffer_t *sys_alloc_framebuffer( ) { - return (framebuffer_t *)0; +static framebuffer_t sys_alloc_framebuffer( ) { + return (framebuffer_t){ + .address = fb_addr, .width = width, .height = height, .pitch = pitch, .bpp = bpp, .reserved = 0 + }; } static void sys_free_framebuffer(framebuffer_t *frame) { diff --git a/modlib/types.h b/modlib/types.h index 744fcf6..7d8980e 100644 --- a/modlib/types.h +++ b/modlib/types.h @@ -97,7 +97,7 @@ typedef struct { typedef struct { uint64_t offset; void (*fb_printf)(char *str, ...); - framebuffer_t *(*alloc_framebuffer)( ); + framebuffer_t (*alloc_framebuffer)( ); void (*free_framebuffer)(framebuffer_t *frame); void *(*alloc)(uint64_t size); void (*free)(void *ptr);