diff --git a/loader/Cargo.toml b/loader/Cargo.toml index 77400fb77..ae5439cfa 100644 --- a/loader/Cargo.toml +++ b/loader/Cargo.toml @@ -9,6 +9,7 @@ edition = "2018" description = "Initial kernel loader for Xous" [dependencies] +xous = "0.9.64" ed25519-dalek-loader = { path = "ed25519-dalek-loader", default-features = false, optional = true } curve25519-dalek-loader = { path = "curve25519-dalek-loader", default-features = false, features = [ "u32e_backend", diff --git a/loader/src/lib.rs b/loader/src/lib.rs index e9e285a04..584dd3fcf 100644 --- a/loader/src/lib.rs +++ b/loader/src/lib.rs @@ -21,6 +21,7 @@ pub const FLG_A: usize = 0x40; pub const FLG_D: usize = 0x80; pub const FLG_P: usize = 0x200; +pub const SWAP_FLG_WIRED: u32 = 0x1_00; pub const FLG_SWAP_USED: u32 = 0x8000_0000; // Locate the hard-wired IFRAM allocations for UDMA diff --git a/loader/src/phase2.rs b/loader/src/phase2.rs index bd736c89a..010dc658d 100644 --- a/loader/src/phase2.rs +++ b/loader/src/phase2.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "swap")] +use xous::arch::{SWAP_CFG_VADDR, SWAP_COUNT_VADDR, SWAP_PT_VADDR}; + #[cfg(feature = "swap")] use crate::swap::*; use crate::*; diff --git a/loader/src/platform/cramium/swap.rs b/loader/src/platform/cramium/swap.rs index 374deb0df..809489efc 100644 --- a/loader/src/platform/cramium/swap.rs +++ b/loader/src/platform/cramium/swap.rs @@ -11,6 +11,7 @@ use cramium_hal::udma::{GlobalConfig, Spim, SpimClkPha, SpimClkPol, SpimCs}; use rand_chacha::ChaCha8Rng; use rand_chacha::rand_core::RngCore; use rand_chacha::rand_core::SeedableRng; +use xous::arch::SWAP_HAL_VADDR; use crate::bootconfig::BootConfig; use crate::swap::*; diff --git a/loader/src/swap.rs b/loader/src/swap.rs index af1a68474..1eb7ffc29 100644 --- a/loader/src/swap.rs +++ b/loader/src/swap.rs @@ -4,6 +4,7 @@ use core::mem::size_of; use aes_gcm_siv::Tag; use crate::PAGE_SIZE; +use crate::SWAP_FLG_WIRED; use crate::SWAPPER_PID; /// Virtual address fields: @@ -58,18 +59,6 @@ pub struct RawPage { pub data: [u8; 4096], } -pub const SWAP_PT_VADDR: usize = 0xE000_0000; -// E000_0000 - E100_0000 => 16 MiB of vaddr space for page tables; should be more than enough -pub const SWAP_CFG_VADDR: usize = 0xE100_0000; -pub const SWAP_RPT_VADDR: usize = 0xE100_1000; -pub const SWAP_COUNT_VADDR: usize = 0xE110_0000; -pub const SWAP_APP_UART_VADDR: usize = 0xE180_0000; -#[cfg(feature = "cramium-soc")] -pub const SWAP_APP_UART_IFRAM_VADDR: usize = 0xE180_1000; -// open a large aperture from A000-E000 for a potential RAM-mapped swap area: this gives us up to 1GiB swap -// space. Please don't actually use all of it: performance will be unimaginably bad. -pub const SWAP_HAL_VADDR: usize = 0xA000_0000; - /// Structure passed by the loader into this process at SWAP_RPT_VADDR #[cfg(feature = "swap")] #[repr(C)] @@ -113,9 +102,6 @@ pub fn derive_usable_swap(swap_len: usize) -> usize { pub fn derive_mac_size(swap_len: usize) -> usize { (swap_len / 4096) * size_of::() } -/// This needs to be synchronized with what's in kernel/src/mem.rs -pub const SWAP_FLG_WIRED: u32 = 0x1_00; - #[repr(C)] #[derive(Copy, Clone)]