break out swap_root & improve debug

This commit is contained in:
bunnie 2024-04-09 15:25:37 +08:00
parent a66e4f5901
commit 8abb126577

View file

@ -102,6 +102,8 @@ impl MiniElf {
let mut current_page_addr: usize = 0;
let mut previous_addr: usize = 0;
let mut last_mapped_xip = 0;
#[cfg(feature = "swap")]
let mut last_swap_page = 0;
let image_phys_base = allocator.base_addr as usize + self.load_offset as usize;
// It is a requirement that the image generator lay out the artifacts on disk such that
// the page offsets line up for XIP sections. This assert confirms this necessary pre-condition.
@ -381,6 +383,11 @@ impl MiniElf {
flag_defaults
};
allocator.map_page(tt, map_phys_addr, virt_page, flags, pid as XousPid);
#[cfg(feature = "swap")]
if ini_type == IniType::IniS {
allocator.map_swap(last_swap_page * 0x1000, virt_page, pid);
last_swap_page += 1;
}
last_mapped_xip = virt_page;
section_map_phys_offset += PAGE_SIZE;
@ -426,7 +433,7 @@ impl MiniElf {
IniType::IniS => {
#[cfg(feature = "swap")]
{
allocator.processes[pid as usize - 1].swap_root >> 12
allocator.swap_root[pid as usize - 1] >> 12
}
#[cfg(not(feature = "swap"))]
{