From 7b7c0a79787957902cb5a0f0b971dac087ed9955 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 9 Jul 2017 12:32:01 +0200 Subject: fixed the vga_refresh bug. the problem is under optimization the code gets so fast that we get races in the task refershing the VGA screen. For now we fix also high CPU usage in idle tasks with a 'kernel_halt' (well, later a yield or a more clever task scheduler should help). This is a hacky solution for now.. --- BUGS | 2 -- README | 4 ++++ src/Makefile | 2 +- src/kernel/kernel.c | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/BUGS b/BUGS index 1104f2a..0f618d8 100644 --- a/BUGS +++ b/BUGS @@ -21,6 +21,4 @@ outside of the library. Then in the libc test directory we have to implement a stub module for instance using some host functions like standard io of the host C library -- VGA graphic mode switch fails with optimizations on (at least with - gcc and clang) diff --git a/README b/README index d5ab4d6..b5ae0db 100644 --- a/README +++ b/README @@ -58,6 +58,10 @@ with the following settings in the user ~/.gdbinit set auto-load local-gdbinit set auto-load safe-path / +for assembly code view: + +set disassemble-next-line on + links ----- diff --git a/src/Makefile b/src/Makefile index 0586d4b..b44e310 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ CC := gcc INCLUDES = -I. -Ilibc -Ihardware -Idrivers -Idrivers/hdi -Idrivers/hdi/ps2 -Idrivers/video -Ikernel -Igui -CFLAGS := -std=c99 -m32 -march=i486 -ffreestanding -O0 -g -Werror $(INCLUDES) +CFLAGS := -std=c99 -m32 -march=i486 -ffreestanding -O3 -g -Werror $(INCLUDES) LD := ld NASMFLAGS := -f elf32 NASM := nasm diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index dd61f45..f2210d6 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -321,6 +321,7 @@ static void handle_mouse_event( mouse_event_t *event, void *context ) static void funcA( void ) { while( true ) { + kernel_halt( ); //~ printf( "A" ); //~ kernel_panic( "panic in task" ); } @@ -329,6 +330,7 @@ static void funcA( void ) static void funcB( void ) { while( true ) { + kernel_halt( ); //~ printf( "B" ); } } @@ -336,6 +338,7 @@ static void funcB( void ) static void refresh_screen( void ) { while( true ) { + kernel_halt( ); switch( global_context.mode ) { case MODE_TEXT: // nothing to draw or refresh in text mode, the @@ -355,7 +358,7 @@ static void refresh_screen( void ) interrupts_enable( ); break; - } + } } } -- cgit v1.2.3-54-g00ecf