From 3b2cf8bbb552ff798f5f5efddfd9b78c2c9d9a4a Mon Sep 17 00:00:00 2001 From: pjht Date: Fri, 6 Sep 2024 10:44:44 -0500 Subject: [PATCH] Disable IPC logging to serial port --- src/interrupts.rs | 74 +++++++++++++++++++++++------------------------ src/main.rs | 30 +++++++++---------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/interrupts.rs b/src/interrupts.rs index e07a604..c85030e 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -414,43 +414,43 @@ extern "C" fn syscall_handler() { let len = usize(regs.rsi); assert!(len <= buffer.len()); if TASKING.message_queue_mut(pid, |_| ()).is_ok() { - #[expect( - clippy::unwrap_used, - reason = "The min call guarantees that the value is in the range of a u32 before the cast" - )] - let trunc_len: u32 = usize::min(len, 4096).try_into().unwrap(); - #[expect( - clippy::arithmetic_side_effects, - reason = "Can't underflow, as x % 4 < 4 no matter the x" - )] - let padding = if (trunc_len % 4) != 0 { 4 - (trunc_len % 4) } else { 0 }; - #[expect( - clippy::arithmetic_side_effects, - reason = "Can't overflow, as padding is no more than 4 and trunc_len is no more than 4096." - )] - let padded_len = trunc_len + padding; - #[expect( - clippy::arithmetic_side_effects, - reason = "Can't overflow, as padded_len is no more than 4096 and 4096+24 < u32::MAX" - )] - let total_len = padded_len + 8 + (4 * 4); - SECOND_PORT.write_u32s(&[ - 0x3, // SPB type - total_len, // Total block length - len.saturating_cast::().saturating_add(8), // Packet length - ]); - SECOND_PORT.write_bytes(&pid.to_ne_bytes()); - #[expect( - clippy::indexing_slicing, - reason = "The truncated length is always <= the buffer's length" - )] - SECOND_PORT.write_bytes(&buffer[0..usize(trunc_len)]); - for _ in 0..padding { - SECOND_PORT.write_bytes(&[0]); - } - SECOND_PORT.write_u32s(&[ - total_len, // Total block length - ]); + //#[expect( + // clippy::unwrap_used, + // reason = "The min call guarantees that the value is in the range of a u32 before the cast" + //)] + //let trunc_len: u32 = usize::min(len, 4096).try_into().unwrap(); + //#[expect( + // clippy::arithmetic_side_effects, + // reason = "Can't underflow, as x % 4 < 4 no matter the x" + //)] + //let padding = if (trunc_len % 4) != 0 { 4 - (trunc_len % 4) } else { 0 }; + //#[expect( + // clippy::arithmetic_side_effects, + // reason = "Can't overflow, as padding is no more than 4 and trunc_len is no more than 4096." + //)] + //let padded_len = trunc_len + padding; + //#[expect( + // clippy::arithmetic_side_effects, + // reason = "Can't overflow, as padded_len is no more than 4096 and 4096+24 < u32::MAX" + //)] + //let total_len = padded_len + 8 + (4 * 4); + //SECOND_PORT.write_u32s(&[ + // 0x3, // SPB type + // total_len, // Total block length + // len.saturating_cast::().saturating_add(8), // Packet length + //]); + //SECOND_PORT.write_bytes(&pid.to_ne_bytes()); + //#[expect( + // clippy::indexing_slicing, + // reason = "The truncated length is always <= the buffer's length" + //)] + //SECOND_PORT.write_bytes(&buffer[0..usize(trunc_len)]); + //for _ in 0..padding { + // SECOND_PORT.write_bytes(&[0]); + //} + //SECOND_PORT.write_u32s(&[ + // total_len, // Total block length + //]); let buf_num_pages = buffer.len() / 4096; let buffer = Box::into_raw(buffer); let buf_start_page = diff --git a/src/main.rs b/src/main.rs index 811ed82..78d5725 100644 --- a/src/main.rs +++ b/src/main.rs @@ -270,21 +270,21 @@ pub fn main() { } } - // Before starting init, write the pcapng section header + interface description to the second serial port - SECOND_PORT.write_u32s(&[ - 0x0A0D_0D0A, // SHB type - 7 * 4, // Total block length - 0x1A2B_3C4D, // Byte order magic - 0x0000_0001, // Version (1.0) - 0xFFFF_FFFF, // Length upper (-1) across both - 0xFFFF_FFFF, // Length lower - 7 * 4, // Total block length - 0x1, // IDB type - 5 * 4, // Total block length - 147, // Link type - 4096 + 8, // Packet length limit, - 5 * 4, // Total block length - ]); + //// Before starting init, write the pcapng section header + interface description to the second serial port + //SECOND_PORT.write_u32s(&[ + // 0x0A0D_0D0A, // SHB type + // 7 * 4, // Total block length + // 0x1A2B_3C4D, // Byte order magic + // 0x0000_0001, // Version (1.0) + // 0xFFFF_FFFF, // Length upper (-1) across both + // 0xFFFF_FFFF, // Length lower + // 7 * 4, // Total block length + // 0x1, // IDB type + // 5 * 4, // Total block length + // 147, // Link type + // 4096 + 8, // Packet length limit, + // 5 * 4, // Total block length + //]); #[expect( clippy::unwrap_used,