diff options
Diffstat (limited to '')
| -rw-r--r-- | rsnix/src/serial.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rsnix/src/serial.rs b/rsnix/src/serial.rs index 03fa570..484a114 100644 --- a/rsnix/src/serial.rs +++ b/rsnix/src/serial.rs | |||
| @@ -91,12 +91,21 @@ macro_rules! serial_print { | |||
| 91 | }}; | 91 | }}; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | /// Prints a line to serial and appends it to the kernel log ring | ||
| 95 | /// (klog — see /dev/klog). Every kernel-side message funnels through | ||
| 96 | /// here, so the ring captures the whole boot sequence for free. | ||
| 97 | /// User-facing shell output must NOT use this macro (shell output would | ||
| 98 | /// pollute the boot log); it writes to the serial port directly. | ||
| 94 | #[macro_export] | 99 | #[macro_export] |
| 95 | macro_rules! serial_println { | 100 | macro_rules! serial_println { |
| 96 | () => { $crate::serial::write_str("\r\n"); }; | 101 | () => { |
| 102 | $crate::serial::write_str("\r\n"); | ||
| 103 | $crate::klog::append_fmt(core::format_args!("")); | ||
| 104 | }; | ||
| 97 | ($($arg:tt)*) => {{ | 105 | ($($arg:tt)*) => {{ |
| 98 | $crate::serial_print!($($arg)*); | 106 | $crate::serial_print!($($arg)*); |
| 99 | $crate::serial::write_str("\r\n"); | 107 | $crate::serial::write_str("\r\n"); |
| 108 | $crate::klog::append_fmt(core::format_args!($($arg)*)); | ||
| 100 | }}; | 109 | }}; |
| 101 | } | 110 | } |
| 102 | 111 | ||
