makefile: introduce a format command to run clang-format all over the kernel source.

This commit is contained in:
RaphProductions 2025-05-11 11:45:04 +02:00
parent c4e98f5ef2
commit a379d66784
47 changed files with 5092 additions and 4603 deletions

63
kernel/src/sys/log.c Executable file → Normal file
View file

@ -1,45 +1,52 @@
#include "sys/arch/x86_64/io.h"
#include "sys/gfx/flanterm/flanterm.h"
#include <lib/spinlock.h>
#include <stdarg.h>
#include <sys/printf.h>
#include <lib/spinlock.h>
extern struct flanterm_context *ft_ctx;
static spinlock_t log_lock = {0};
void log(char *format, ...) {
//spinlock_acquire(&log_lock);
// spinlock_acquire(&log_lock);
// TODO: replace this call with a call to printf() when the RTC is implemented.
char *date = "1970-01-01 00:00:00 | ";
int i2 = 0; for (i2; date[i2] != 0; i2++);;
if (ft_ctx)
flanterm_write(ft_ctx, date, i2);
// TODO: replace this call with a call to printf() when the RTC is
// implemented.
char *date = "1970-01-01 00:00:00 | ";
int i2 = 0;
for (i2; date[i2] != 0; i2++)
;
;
if (ft_ctx)
flanterm_write(ft_ctx, date, i2);
char buf[2048];
va_list l;
va_start(l, format);
npf_vsnprintf(buf, 2048, format, l);
va_end(l);
char buf[2048];
va_list l;
va_start(l, format);
npf_vsnprintf(buf, 2048, format, l);
va_end(l);
int i = 0; for (i; buf[i] != 0; i++);;
if (ft_ctx)
flanterm_write(ft_ctx, buf, i);
int i = 0;
for (i; buf[i] != 0; i++)
;
;
if (ft_ctx)
flanterm_write(ft_ctx, buf, i);
for (int i=0;;i++) {
if (date[i] == '\0')
break;
outb(0xE9, date[i]);
}
for (int i = 0;; i++) {
if (date[i] == '\0')
break;
for (int i=0;;i++) {
if (buf[i] == '\0')
break;
outb(0xE9, buf[i]);
}
outb(0xE9, date[i]);
}
//spinlock_release(&log_lock);
for (int i = 0;; i++) {
if (buf[i] == '\0')
break;
outb(0xE9, buf[i]);
}
// spinlock_release(&log_lock);
}