From 36e8ee0cdaa904ee00710b1d2df16691729cc93d Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 2 Feb 2021 22:27:27 +0200 Subject: Print some multiboot2 information --- libk/stdlib.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'libk/stdlib.h') diff --git a/libk/stdlib.h b/libk/stdlib.h index 3e6619d..44bacf4 100644 --- a/libk/stdlib.h +++ b/libk/stdlib.h @@ -1,14 +1,32 @@ #pragma once #include +#include class Console { public: + virtual void write(char c) = 0; virtual void write(const String &msg) = 0; + virtual void write(int n) = 0; + virtual void write(unsigned int n) = 0; + + static void set(Console *ptr); + static Console *get(); }; -void console_set(Console *ptr); +template void printk(const T &a) { + if (auto *c = Console::get()) { + if constexpr (is_same()) + c->write(String(a)); + else + c->write(a); + } +} -void printk(const String &msg); +template +void printk(const T &a, const Args &...x) { + printk(a); + printk(x...); +} __attribute__((__noreturn__)) void abort(); -- cgit v1.2.1