#define FOOLOS_MODULE_NAME "log" #include "lib/logger/log.h" #include #include "log.h" #include "lib/printf/printf.h" #include "kernel/config.h" #include "lib/int/stdint.h" #include "kernel/time.h" #define BUF_SIZE 4069 static char buffer[BUF_SIZE]; static int first; static int last; void PutConsole(char *str, int color); void log(char *module_name, int log_level, char *format_string, ...) { #ifdef FOOLOS_LOG_OFF return; #endif 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); 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); }