Disable IPC logging to serial port
This commit is contained in:
parent
01a0ee9631
commit
3b2cf8bbb5
@ -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::<u32>().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::<u32>().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 =
|
||||
|
30
src/main.rs
30
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,
|
||||
|
Loading…
Reference in New Issue
Block a user