From df083e306a53e6a45a5730e7059032be43cc75ff Mon Sep 17 00:00:00 2001 From: Nick Shipp Date: Sun, 30 Sep 2018 17:05:47 -0400 Subject: Dirty rotten commit full of badness Milestone: Got SMP cores booting and into long mode. The rest is all trash, but maybe trash worth a future archaeological dig. --- bunny/src/println.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bunny/src/println.rs (limited to 'bunny/src/println.rs') diff --git a/bunny/src/println.rs b/bunny/src/println.rs new file mode 100644 index 0000000..db59e79 --- /dev/null +++ b/bunny/src/println.rs @@ -0,0 +1,31 @@ +#[macro_export] +macro_rules! print { + ($($arg:tt)*) => ({ + use core::fmt::Write; + unsafe { (&*::SYSTEM_TABLE.as_ref().unwrap().con_out) } + .write_fmt(format_args!($($arg)*)) + .expect("could not write to console"); + }); +} + +#[macro_export] +macro_rules! println { + ($fmt:expr) => (print!(concat!($fmt, "\r\n"))); + ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\r\n"), $($arg)*)); +} + +#[macro_export] +macro_rules! dprint { + ($($arg:tt)*) => ({ + if cfg!(debug_assertions) { + print!($($arg)*) + } + }); +} + +#[macro_export] +macro_rules! dprintln { + ($fmt:expr) => (dprint!(concat!($fmt, "\r\n"))); + ($fmt:expr, $($arg:tt)*) => (dprint!(concat!($fmt, "\r\n"), $($arg)*)); +} + -- cgit v1.2.3-54-g00ecf