kernel: format some files

Format some files prior to patching them.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-12-25 23:28:52 +08:00
parent 22cd08dc57
commit d798962151
5 changed files with 21 additions and 14 deletions

View file

@ -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"))]

View file

@ -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;

View file

@ -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(());
}
}
// -------------------------------

View file

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: 2020 Sean Cross <sean@xobs.io>
// 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};

View file

@ -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)