mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add platform dependent implementations
this allows us to get rid of traits. woo!
This commit is contained in:
parent
b4d1b4e5bb
commit
433cc7dfb7
5 changed files with 43 additions and 0 deletions
14
services/xous-swapper/src/platform/cramium/hw.rs
Normal file
14
services/xous-swapper/src/platform/cramium/hw.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/// This is an implementation for SMTs that are accessible only through a SPI
|
||||
/// register interface. The base and bounds must be translated to SPI accesses
|
||||
/// in a hardware-specific manner.
|
||||
pub struct SwapMac {
|
||||
pub base: usize,
|
||||
pub bounds: usize,
|
||||
}
|
||||
impl SwapMac {
|
||||
pub fn new(base: usize, bounds: usize) -> Self { SwapMac { base, bounds } }
|
||||
|
||||
pub fn lookup_mac(&self, swap_page_offset: usize) -> [u8; 16] { todo!() }
|
||||
|
||||
pub fn store_mac(&mut self, swap_page_offset: usize, mac: &[u8; 16]) { todo!() }
|
||||
}
|
||||
1
services/xous-swapper/src/platform/cramium/mod.rs
Normal file
1
services/xous-swapper/src/platform/cramium/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod hw;
|
||||
9
services/xous-swapper/src/platform/mod.rs
Normal file
9
services/xous-swapper/src/platform/mod.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#[cfg(any(feature = "cramium-soc"))]
|
||||
pub mod cramium;
|
||||
#[cfg(any(feature = "cramium-soc"))]
|
||||
pub use cramium::hw::*;
|
||||
|
||||
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||
pub mod precursor;
|
||||
#[cfg(any(feature = "precursor", feature = "renode"))]
|
||||
pub use precursor::hw::*;
|
||||
18
services/xous-swapper/src/platform/precursor/hw.rs
Normal file
18
services/xous-swapper/src/platform/precursor/hw.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/// This defines a set of functions to get and receive MACs (message
|
||||
/// authentication codes, also referred to as the tag in AES-GCM-SIV.
|
||||
pub struct SwapMac {
|
||||
pub macs: &'static mut [[u8; 16]],
|
||||
}
|
||||
impl SwapMac {
|
||||
pub fn new(base: usize, bounds: usize) -> Self {
|
||||
SwapMac {
|
||||
// safety: this is only safe because the loader guarantees memory-mapped SMT is initialized and
|
||||
// aligned and properly mapped into the swapper's memory space.
|
||||
macs: unsafe { core::slice::from_raw_parts_mut(base as *mut [u8; 16], bounds as usize / 16) },
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lookup_mac(&self, swap_page_offset: usize) -> [u8; 16] { todo!() }
|
||||
|
||||
pub fn store_mac(&mut self, swap_page_offset: usize, mac: &[u8; 16]) { todo!() }
|
||||
}
|
||||
1
services/xous-swapper/src/platform/precursor/mod.rs
Normal file
1
services/xous-swapper/src/platform/precursor/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod hw;
|
||||
Loading…
Reference in a new issue