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);