diff options
Diffstat (limited to 'kernel/log.c')
| -rw-r--r-- | kernel/log.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/log.c b/kernel/log.c index af6ebac..179f9a8 100644 --- a/kernel/log.c +++ b/kernel/log.c @@ -6,6 +6,8 @@ #include <stdbool.h> #include "spinlock.h" +#include "smp.h" +#include "apic.h" #include "kernel/kernel.h" #include "driver/serial.h" @@ -23,8 +25,10 @@ static void log_string(char *str) } } -void log(bool color,char *module_name, int prio, char *format_string, ...) +void log(char *module_name, int prio, char *format_string, ...) { + uint32_t cpu=apic_id(); + #ifdef FOOLOS_LOG_OFF return; #endif @@ -44,10 +48,10 @@ void log(bool color,char *module_name, int prio, char *format_string, ...) tfp_vsprintf(buf_info,format_string,va); va_end(va); - if(color) tfp_sprintf(buf_log,"\033[36;40m%s\033[31;40m %s:\033[37;40m %s\n",buf_time,module_name,buf_info); - else tfp_sprintf(buf_log,"%s %s: %s\n",buf_time,module_name,buf_info); + tfp_sprintf(buf_log,"\033[36;40m%s\033[33;40mCPU %02d:\033[31;40m%s:\033[37;40m %s\n",buf_time,cpu,module_name,buf_info); +// tfp_sprintf(buf_log,"%sCPU %02d:%s: %s\n",buf_time,cpu,module_name,buf_info); -// spinlock_spin(SPINLOCK_LOG); + spinlock_spin(SPINLOCK_LOG); log_string(buf_log); -// spinlock_release(SPINLOCK_LOG); + spinlock_release(SPINLOCK_LOG); } |
