Convert \n to \r\n on serial output

This commit is contained in:
pjht 2024-08-06 18:39:57 -05:00
parent f7c5b3aad4
commit 1ceb2e1607
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E
2 changed files with 7 additions and 3 deletions

View File

@ -244,7 +244,11 @@ extern "C" fn syscall_handler() {
match regs.rax { match regs.rax {
0 => { 0 => {
let rval = if let Some(chr) = char::from_u32(regs.rcx.wrapping_cast()) { let rval = if let Some(chr) = char::from_u32(regs.rcx.wrapping_cast()) {
if chr == '\n' {
print!("\r\n");
} else {
print!("{}", chr); print!("{}", chr);
}
0 0
} else { } else {
1 1

View File

@ -50,10 +50,10 @@ macro_rules! print {
#[macro_export] #[macro_export]
macro_rules! println { macro_rules! println {
() => ($crate::print!("\n")); () => ($crate::print!("\r\n"));
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
$crate::serial::_print(format_args!($($arg)*)); $crate::serial::_print(format_args!($($arg)*));
$crate::print!("\n"); $crate::print!("\r\n");
}) })
} }