Add functions for WARNING, ERROR and FIXME debug outputs

This commit is contained in:
g1n 2022-02-09 19:33:06 +02:00
parent a4a7626010
commit 472a220b40
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
4 changed files with 37 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <paging.h>
#include <stdio.h>
#include <stdlib.h>
#include <serial.h>
void early_kernel_main() {
serial_init();

View File

@ -9,5 +9,8 @@ int serial_init();
int dbg_putchar(int c);
int vdbgf(const char *restrict format, va_list ap);
int dbgf(const char *restrict format, ...);
int warn(const char *restrict format, ...);
int error(const char *restrict format, ...);
int fixme(const char *restrict format, ...);
#endif

View File

@ -6,4 +6,7 @@
void kernel_main() {
kprintf("Hello, World!\n");
dbgf("Hello serial World!\n");
warn("test warning debug %d\n", 42);
error("test error debug %d\n", 42);
fixme("test fixme debug %d\n", 42);
}

View File

@ -53,3 +53,33 @@ int dbgf(const char *restrict format, ...) {
va_end(ap);
return size;
}
int warn(const char *restrict format, ...) {
int size;
va_list ap;
va_start(ap, format);
dbgf("WARNING: ");
size = vdbgf(format, ap);
va_end(ap);
return size;
}
int error(const char *restrict format, ...) {
int size;
va_list ap;
va_start(ap, format);
dbgf("ERROR: ");
size = vdbgf(format, ap);
va_end(ap);
return size;
}
int fixme(const char *restrict format, ...) {
int size;
va_list ap;
va_start(ap, format);
dbgf("FIXME: ");
size = vdbgf(format, ap);
va_end(ap);
return size;
}