mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Fixed debugf(); OS now works, but immediatly triggers a Page Fault after printing a 'k'
This commit is contained in:
+8
-2
@@ -1,12 +1,18 @@
|
||||
#include <error/debug.h>
|
||||
#include <ports/serial.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
static void _dbgPutc(char c, void* arg) {
|
||||
(void)arg;
|
||||
serialWrite(PORT_COM1, c);
|
||||
if (c == '\n') { serialWrite(PORT_COM1, '\r'); }
|
||||
}
|
||||
|
||||
int debugf(const char* fmt, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
serialPrint(PORT_COM1, fmt); // TODO: use a printf
|
||||
int res = 0;
|
||||
int res = vpprintf(_dbgPutc, NULL, fmt, va);
|
||||
va_end(va);
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user