From 06e382afcbf199e5e4ec92574a3872ab04fb6e9e Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Thu, 4 Sep 2014 15:16:13 +0200 Subject: Improved physical memory manager and cleaning up. --- lib/logger/log.c | 68 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/logger/log.c b/lib/logger/log.c index c9bb652..4a510f9 100644 --- a/lib/logger/log.c +++ b/lib/logger/log.c @@ -1,44 +1,76 @@ -#include "log.h" +#define FOOLOS_MODULE_NAME "log" + +#include "lib/logger/log.h" #include + +#include "log.h" #include "lib/int/stdint.h" +#include "kernel/time.h" + +#define BUF_SIZE 4069 -void PutConsole(char *str, int color, va_list va); +static char buffer[BUF_SIZE]; +static int first; +static int last; -volatile uint64_t task_system_clock; // in task.c +void PutConsole(char *str, int color); void log(char *module_name, int log_level, char *format_string, ...) { - if(log_level=BUF_SIZE)first=(first+1)%BUF_SIZE; + if(last>first)if(BUF_SIZE-last+first>=BUF_SIZE)first=(first+1)%BUF_SIZE; + } + + } void panic(char *module_name, char *format_string) { - - PutConsole("!! KERNEL PANIC !! ",0b1111100000000000,0); - PutConsole(module_name,0b1111100000000000,0); - PutConsole(" : ",0b0000011111100000,0); - PutConsole(format_string,0b1111100000000000,0); + PutConsole("!! KERNEL PANIC !! ",0b1111100000000000); + PutConsole(module_name,0b1111100000000000); + PutConsole(" : ",0b0000011111100000); + PutConsole(format_string,0b1111100000000000); while(1); // halt - } + +void log_init() +{ + first=last=0; +} + +void log_log() +{ + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"init buffer at: 0x%08X, first=%08X, last=%08X",buffer,&first,&last); +} + -- cgit v1.2.3