From 9101abf2c494b8038b107b02d32d62d09f523efb Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 12 May 2024 21:51:14 +0800 Subject: [PATCH] make swap resume-compatible --- services/xous-susres/Cargo.toml | 3 ++- services/xous-susres/src/main.rs | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/services/xous-susres/Cargo.toml b/services/xous-susres/Cargo.toml index d64b31e20..a6d46ab5c 100644 --- a/services/xous-susres/Cargo.toml +++ b/services/xous-susres/Cargo.toml @@ -16,6 +16,7 @@ log-server = { package = "xous-api-log", version = "0.1.56" } xous = "0.9.60" xous-ipc = "0.9.60" log = "0.4.14" +loader = { path = "../../loader", default-features = false } num-derive = { version = "0.3.3", default-features = false } num-traits = { version = "0.2.14", default-features = false } @@ -30,7 +31,7 @@ utralib = { version = "0.1.24", optional = true, default-features = false } precursor = ["utralib/precursor"] hosted = ["utralib/hosted"] renode = ["utralib/renode"] -swap = [] +swap = ["loader/swap"] sus_reboot = [ ] # when selected, suspend triggers an immediate reboot instead of suspend. For testing only. debugprint = [] diff --git a/services/xous-susres/src/main.rs b/services/xous-susres/src/main.rs index 068d6c41f..971b2588b 100644 --- a/services/xous-susres/src/main.rs +++ b/services/xous-susres/src/main.rs @@ -146,9 +146,7 @@ mod implementation { // 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 - * stack area */ + xous::MemoryAddress::new(0x4100_0000 - loader::GUARD_MEMORY_BYTES), // TODO: fix hard-coding of top of RAM None, 4096, xous::MemoryFlags::R | xous::MemoryFlags::W, @@ -156,7 +154,7 @@ mod implementation { .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 + xous::MemoryAddress::new(0x4080_0000 - loader::GUARD_MEMORY_BYTES), // TODO: fix hard-coding of top of RAM None, 4096, xous::MemoryFlags::R | xous::MemoryFlags::W,