diff options
author | Nick Shipp <nick@shipp.ninja> | 2018-09-30 17:05:47 -0400 |
---|---|---|
committer | Nick Shipp <nick@shipp.ninja> | 2018-09-30 17:05:47 -0400 |
commit | df083e306a53e6a45a5730e7059032be43cc75ff (patch) | |
tree | d6e54f9fa587e7e001e2e751efad8e76e106b31f /bunny/src/println.rs | |
parent | e8c36b131ac12832bb1d5de0e3a710733fca88ac (diff) |
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.
Diffstat (limited to 'bunny/src/println.rs')
-rw-r--r-- | bunny/src/println.rs | 31 |
1 files changed, 31 insertions, 0 deletions
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)*)); +} + |