From 733b2d0fc42361f9a32315bb6e656b115d8c7c0f Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 15 Jul 2017 17:48:55 +0200 Subject: same for the graphical VGA driver --- src/kernel/kernel.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index bd13e07..00f614f 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -46,7 +46,7 @@ typedef struct { driver_manager_t driver_manager; task_manager_t task_manager; memory_manager_t memory_manager; - vga_t vga; + vga_t *vga; mode_t mode; keyboard_t *keyboard; mouse_t *mouse; @@ -150,8 +150,9 @@ void kernel_main( void ) pci_controller_scan_and_register( &pci_controller, &global_context.driver_manager, &interrupt ); // TODO: merge with the text mode vga_text_t object - vga_init( &global_context.vga ); - driver_manager_add_driver( &global_context.driver_manager, (driver_t *)&global_context.vga ); + global_context.vga = (vga_t *)malloc( sizeof( vga_t ) ); + vga_init( global_context.vga ); + driver_manager_add_driver( &global_context.driver_manager, (driver_t *)global_context.vga ); puts( "Activating drivers" ); driver_manager_activate_all( &global_context.driver_manager ); @@ -332,9 +333,9 @@ static void refresh_screen( void ) interrupts_disable( ); // as vga_t is equals to the graphical context for now - ((widget_t *)&global_context.desktop)->vtable->draw( &global_context.desktop, &global_context.vga ); + ((widget_t *)&global_context.desktop)->vtable->draw( &global_context.desktop, global_context.vga ); - vga_refresh( &global_context.vga ); + vga_refresh( global_context.vga ); interrupts_enable( ); @@ -345,7 +346,7 @@ static void refresh_screen( void ) static void switch_to_graphics_mode( global_context_t *global_context ) { - vga_t *vga = &global_context->vga; + vga_t *vga = global_context->vga; vga_text_t *vga_text = &global_context->vga_text; mouse_t *mouse = global_context->mouse; desktop_t *desktop = &global_context->desktop; @@ -379,7 +380,7 @@ static void switch_to_graphics_mode( global_context_t *global_context ) mouse_set_resolution( mouse, vga->mode.x, vga->mode.y ); // enable Z buffering - vga_use_z_buffer( &global_context->vga, true ); + vga_use_z_buffer( global_context->vga, true ); global_context->mode = MODE_GRAPHICS; } @@ -387,7 +388,7 @@ static void switch_to_graphics_mode( global_context_t *global_context ) static void switch_to_text_mode( global_context_t *global_context ) { - vga_t *vga = &global_context->vga; + vga_t *vga = global_context->vga; vga_text_t *vga_text = &global_context->vga_text; mouse_t *mouse = global_context->mouse; -- cgit v1.2.3-54-g00ecf