diff options
Diffstat (limited to 'arch/x86_64/debug/printf.c')
| -rw-r--r-- | arch/x86_64/debug/printf.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86_64/debug/printf.c b/arch/x86_64/debug/printf.c new file mode 100644 index 0000000..13737b9 --- /dev/null +++ b/arch/x86_64/debug/printf.c @@ -0,0 +1,20 @@ +#include "lib/printf.h" +#include "../hal/serial_com.h" +#include "api/error.h" +#include "debug/debug.h" + +int +kvprintf(const char *fmt, va_list ap) +{ + if(!_debug_has_output) return -EBADCALL; + + char buffer[256] = { 0 }; + int r = vsnprintf(buffer, 256, fmt, ap); + int wlen = (r > 256 ? 256 : r); + +#ifdef DEBUG_SERIAL + serial_com_write(SERIAL_COM1, buffer, wlen); +#endif + + return r; +} |
