allow xous-susres to function with swap enabled

the reason we're doing this is because the pre-emption timer
lives in this crate too. We don't (can't!) suspend/resume
with swap (yet!) but the pre-emption timer got stuck in susres
so it can be directly turned off without message passing/context
switching during the suspend and resume ops.
This commit is contained in:
bunnie 2024-05-04 01:50:13 +08:00
parent 978dd1bf38
commit 87e32687f1
2 changed files with 10 additions and 0 deletions

View file

@ -30,6 +30,7 @@ utralib = { version = "0.1.24", optional = true, default-features = false }
precursor = ["utralib/precursor"]
hosted = ["utralib/hosted"]
renode = ["utralib/renode"]
swap = []
sus_reboot = [
] # when selected, suspend triggers an immediate reboot instead of suspend. For testing only.
debugprint = []

View file

@ -144,6 +144,7 @@ mod implementation {
.expect("couldn't map SusRes CSR range");
// note that mapping a page zeroes it out. Plus, this should have been zero'd by the bootloader.
#[cfg(not(feature = "swap"))]
let marker = xous::syscall::map_memory(
xous::MemoryAddress::new(0x4100_0000 - 0x3000), /* this is a special, hard-coded location;
* 0x2000 is the size of the bootloader's
@ -153,6 +154,14 @@ mod implementation {
xous::MemoryFlags::R | xous::MemoryFlags::W,
)
.expect("couldn't map clean suspend page");
#[cfg(feature = "swap")]
let marker = xous::syscall::map_memory(
None, // map a dummy page -- we need this process for the preemption timer
None,
4096,
xous::MemoryFlags::R | xous::MemoryFlags::W,
)
.expect("couldn't map clean suspend page");
let seed_csr = xous::syscall::map_memory(
xous::MemoryAddress::new(utra::seed::HW_SEED_BASE),