cargo fmt

This commit is contained in:
Simon Renblad 2024-12-23 12:51:10 +08:00
parent 850e783139
commit a0281e4989
5 changed files with 38 additions and 23 deletions

View File

@ -5,7 +5,8 @@ pub const MAX_PACKET: usize = 1024;
// maximum size of arbitrary payloads
// used by satellite -> master analyzer, subkernel exceptions
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
pub const SAT_PAYLOAD_MAX_SIZE: usize = /*max size*/
MAX_PACKET - /*CRC*/4 - /*packet ID*/1 - /*last*/1 - /*length*/2;
// used by DDMA, subkernel program data (need to provide extra ID and destination)
pub const MASTER_PAYLOAD_MAX_SIZE: usize = SAT_PAYLOAD_MAX_SIZE - /*source*/1 - /*destination*/1 - /*ID*/4;

View File

@ -1,8 +1,8 @@
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use core::arch::asm;
use core_io::{Error as IoError, Read, Write};
use core::arch::asm;
#[derive(Debug, Clone)]
pub struct Cursor<T> {
@ -48,7 +48,9 @@ impl<T: AsRef<[u8]>> Read for Cursor<T> {
let len = buf.len().min(data.len());
// ``copy_from_slice`` generates AXI bursts, use a regular loop instead
for i in 0..len {
unsafe { asm!("", options(preserves_flags, nostack, readonly)); }
unsafe {
asm!("", options(preserves_flags, nostack, readonly));
}
buf[i] = data[i];
}
self.pos += len;
@ -61,7 +63,9 @@ impl Write for Cursor<&mut [u8]> {
let data = &mut self.inner[self.pos..];
let len = buf.len().min(data.len());
for i in 0..len {
unsafe { asm!("", options(preserves_flags, nostack, readonly)); }
unsafe {
asm!("", options(preserves_flags, nostack, readonly));
}
data[i] = buf[i];
}
self.pos += len;

View File

@ -96,30 +96,36 @@ struct ExceptionBuffer {
}
static mut EXCEPTION_BUFFER: ExceptionBuffer = ExceptionBuffer {
uw_exceptions: [const { uw::_Unwind_Exception {
uw_exceptions: [const {
uw::_Unwind_Exception {
exception_class: EXCEPTION_CLASS,
exception_cleanup: cleanup,
private: [0; uw::unwinder_private_data_size],
}}; MAX_INFLIGHT_EXCEPTIONS],
}
}; MAX_INFLIGHT_EXCEPTIONS],
exceptions: [None; MAX_INFLIGHT_EXCEPTIONS + 1],
exception_stack: [-1; MAX_INFLIGHT_EXCEPTIONS + 1],
backtrace: [(0, 0); MAX_BACKTRACE_SIZE],
backtrace_size: 0,
stack_pointers: [const { StackPointerBacktrace {
stack_pointers: [const {
StackPointerBacktrace {
stack_pointer: 0,
initial_backtrace_size: 0,
current_backtrace_size: 0,
}}; MAX_INFLIGHT_EXCEPTIONS + 1],
}
}; MAX_INFLIGHT_EXCEPTIONS + 1],
exception_count: 0,
};
pub unsafe extern "C" fn reset_exception_buffer() {
trace!("reset exception buffer");
EXCEPTION_BUFFER.uw_exceptions = [const { uw::_Unwind_Exception {
EXCEPTION_BUFFER.uw_exceptions = [const {
uw::_Unwind_Exception {
exception_class: EXCEPTION_CLASS,
exception_cleanup: cleanup,
private: [0; uw::unwinder_private_data_size],
}}; MAX_INFLIGHT_EXCEPTIONS];
}
}; MAX_INFLIGHT_EXCEPTIONS];
EXCEPTION_BUFFER.exceptions = [None; MAX_INFLIGHT_EXCEPTIONS + 1];
EXCEPTION_BUFFER.exception_stack = [-1; MAX_INFLIGHT_EXCEPTIONS + 1];
EXCEPTION_BUFFER.backtrace_size = 0;

View File

@ -396,9 +396,13 @@ impl<'a> Manager<'_> {
self.session = Session::new(id);
self.control.restart();
self.control
.tx
.send(kernel::Message::LoadRequest(self.kernels.get(&id).ok_or_else(|| Error::KernelNotFound)?.library.clone()));
self.control.tx.send(kernel::Message::LoadRequest(
self.kernels
.get(&id)
.ok_or_else(|| Error::KernelNotFound)?
.library
.clone(),
));
let reply = self.control.rx.recv();
match reply {
kernel::Message::LoadCompleted => Ok(()),