From 1ceb2e1607c20745ac71a9604c0b5da755c4f0f3 Mon Sep 17 00:00:00 2001 From: pjht Date: Tue, 6 Aug 2024 18:39:57 -0500 Subject: [PATCH] Convert \n to \r\n on serial output --- src/interrupts.rs | 6 +++++- src/serial.rs | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/interrupts.rs b/src/interrupts.rs index 95d9565..e82c3b4 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -244,7 +244,11 @@ extern "C" fn syscall_handler() { match regs.rax { 0 => { let rval = if let Some(chr) = char::from_u32(regs.rcx.wrapping_cast()) { - print!("{}", chr); + if chr == '\n' { + print!("\r\n"); + } else { + print!("{}", chr); + } 0 } else { 1 diff --git a/src/serial.rs b/src/serial.rs index 1c96ffe..95a8308 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -50,10 +50,10 @@ macro_rules! print { #[macro_export] macro_rules! println { - () => ($crate::print!("\n")); + () => ($crate::print!("\r\n")); ($($arg:tt)*) => ({ $crate::serial::_print(format_args!($($arg)*)); - $crate::print!("\n"); + $crate::print!("\r\n"); }) }