diff --git a/loader/src/swap.rs b/loader/src/swap.rs index d29a940c8..f9234844a 100644 --- a/loader/src/swap.rs +++ b/loader/src/swap.rs @@ -39,3 +39,26 @@ pub struct RawPage { } 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; + +/// Structure passed by the loader into this process at SWAP_RPT_VADDR +#[cfg(feature = "swap")] +#[repr(C)] +pub struct SwapSpec { + pub key: [u8; 32], + /// Count of PIDs in the system. Could be a u8, but, make it a u32 because we have + /// the space and word alignment is good for stuff being tossed through unsafe pointers. + pub pid_count: u32, + pub rpt_len_bytes: u32, + /// Base address of swap memory. If swap is memory-mapped, this is a virtual address. + /// If swap is device-mapped, it's the physical offset in the device. + pub swap_base: u32, + /// Length of swap region in bytes + pub swap_len: u32, + /// Base of the message authentication code (MAC) region + pub mac_base: u32, + /// LENGTH of the MAC region in bytes + pub mac_len: u32, +}