From d798962151ccbe06e8746785128775b80745d126 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 25 Dec 2023 23:28:52 +0800 Subject: [PATCH] kernel: format some files Format some files prior to patching them. Signed-off-by: Sean Cross --- kernel/src/arch/riscv/mod.rs | 2 -- kernel/src/arch/riscv/process.rs | 2 +- kernel/src/mem.rs | 9 +++++++-- kernel/src/server.rs | 1 - kernel/src/syscall.rs | 21 +++++++++++++-------- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/kernel/src/arch/riscv/mod.rs b/kernel/src/arch/riscv/mod.rs index fa97517a0..1c44c0c1b 100644 --- a/kernel/src/arch/riscv/mod.rs +++ b/kernel/src/arch/riscv/mod.rs @@ -10,8 +10,6 @@ pub mod panic; pub mod process; pub mod syscall; -pub use process::Thread; - #[cfg(any(feature = "precursor", feature = "renode"))] use crate::mem::MemoryManager; #[cfg(any(feature = "precursor", feature = "renode"))] diff --git a/kernel/src/arch/riscv/process.rs b/kernel/src/arch/riscv/process.rs index 28c4c939a..a4cc54fe1 100644 --- a/kernel/src/arch/riscv/process.rs +++ b/kernel/src/arch/riscv/process.rs @@ -386,7 +386,7 @@ impl Process { } process.inner = Default::default(); - process.inner.pid = pid; + process.inner.pid = pid; // Mark the stack as "unallocated-but-free" let init_sp = (thread_init.stack.as_ptr() as usize) & !0xfff; diff --git a/kernel/src/mem.rs b/kernel/src/mem.rs index dd19ed165..4bd0d942f 100644 --- a/kernel/src/mem.rs +++ b/kernel/src/mem.rs @@ -739,9 +739,14 @@ impl MemoryManager { #[cfg(feature = "atsama5d27")] { let uart_base = crate::platform::atsama5d2::uart::HW_UART_BASE as usize; - if pid.get() != 1 && (addr == uart_base || addr == uart_base + 0x1000 || addr == uart_base + 0x2000 || addr == uart_base + 0x3000) { + if pid.get() != 1 + && (addr == uart_base + || addr == uart_base + 0x1000 + || addr == uart_base + 0x2000 + || addr == uart_base + 0x3000) + { klog!("[!] UART sharing workaround used for {:08x} address", addr); - return Ok(()) + return Ok(()); } } // ------------------------------- diff --git a/kernel/src/server.rs b/kernel/src/server.rs index f62220e10..104b0d03d 100644 --- a/kernel/src/server.rs +++ b/kernel/src/server.rs @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2020 Sean Cross // SPDX-License-Identifier: Apache-2.0 -pub use crate::arch::process::Thread; use crate::{mem::MemoryManager, services::SystemServices}; use core::mem; use xous_kernel::{MemoryAddress, MemoryRange, MemorySize, Message, MessageSender, PID, SID, TID}; diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index c08f9b14c..fdb588259 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -475,9 +475,7 @@ fn return_result( return Err(xous_kernel::Error::DoubleFree); } WaitingMessage::MovedMemory => { - klog!( - "WARNING: Tried to wait on a scalar message that was actually moved memory" - ); + klog!("WARNING: Tried to wait on a scalar message that was actually moved memory"); return Err(xous_kernel::Error::DoubleFree); } WaitingMessage::None => { @@ -605,9 +603,7 @@ fn reply_and_receive_next( } } WaitingMessage::MovedMemory => { - klog!( - "WARNING: Tried to wait on a scalar message that was actually moved memory" - ); + klog!("WARNING: Tried to wait on a scalar message that was actually moved memory"); return Err(xous_kernel::Error::DoubleFree); } WaitingMessage::None => { @@ -745,12 +741,21 @@ fn receive_message(pid: PID, tid: TID, sid: SID, blocking: ExecutionType) -> Sys } pub fn handle(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallResult { - klog!("KERNEL({}:{}): Syscall {:x?}, in_irq={}", pid, tid, call, in_irq); + klog!( + "KERNEL({}:{}): Syscall {:x?}, in_irq={}", + pid, + tid, + call, + in_irq + ); // let call_string = format!("{:x?}", call); // let start_time = std::time::Instant::now(); #[allow(clippy::let_and_return)] let result = if in_irq && !call.can_call_from_interrupt() { - klog!("[!] Called {:?} that's cannot be called from the interrupt handler!", call); + klog!( + "[!] Called {:?} that's cannot be called from the interrupt handler!", + call + ); Err(xous_kernel::Error::InvalidSyscall) } else { handle_inner(pid, tid, in_irq, call)