forked from Bananymous/banan-os
Kernel: Move debug printing to its own file
It didn't make sense that dprint was defined in Serial.h. We also now dump dprint to tty if there is no serial and tty is initialized
This commit is contained in:
32
kernel/include/kernel/Debug.h
Normal file
32
kernel/include/kernel/Debug.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/Formatter.h>
|
||||
#include <kernel/PIT.h>
|
||||
|
||||
#define dprintln(...) \
|
||||
do { \
|
||||
BAN::Formatter::print(Debug::putchar, "[{5}.{3}] {}:{}: ", PIT::ms_since_boot() / 1000, PIT::ms_since_boot() % 1000, __FILE__, __LINE__); \
|
||||
BAN::Formatter::print(Debug::putchar, __VA_ARGS__); \
|
||||
BAN::Formatter::print(Debug::putchar, "\r\n"); \
|
||||
} while(false)
|
||||
|
||||
#define dwarnln(...) \
|
||||
do { \
|
||||
BAN::Formatter::print(Debug::putchar, "\e[33m"); \
|
||||
dprintln(__VA_ARGS__); \
|
||||
BAN::Formatter::print(Debug::putchar, "\e[m"); \
|
||||
} while(false)
|
||||
|
||||
#define derrorln(...) \
|
||||
do { \
|
||||
BAN::Formatter::print(Debug::putchar, "\e[31m"); \
|
||||
dprintln(__VA_ARGS__); \
|
||||
BAN::Formatter::print(Debug::putchar, "\e[m"); \
|
||||
} while(false)
|
||||
|
||||
#define BOCHS_BREAK() asm volatile("xchgw %bx, %bx")
|
||||
|
||||
namespace Debug
|
||||
{
|
||||
void putchar(char);
|
||||
}
|
||||
Reference in New Issue
Block a user