mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add structure to differentiate image type
we now have three image types: inie, inif, inis; migrate away from a simple "xip" flag to something that can differentiate between all three options.
This commit is contained in:
parent
a732eed679
commit
cdbd5dc0f4
1 changed files with 19 additions and 1 deletions
|
|
@ -59,6 +59,16 @@ pub struct PageTable {
|
||||||
entries: [usize; PAGE_SIZE / WORD_SIZE],
|
entries: [usize; PAGE_SIZE / WORD_SIZE],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
|
pub enum IniType {
|
||||||
|
// RAM
|
||||||
|
IniE,
|
||||||
|
// XIP
|
||||||
|
IniF,
|
||||||
|
// Swap
|
||||||
|
IniS,
|
||||||
|
}
|
||||||
|
|
||||||
/// Entrypoint
|
/// Entrypoint
|
||||||
/// This makes the program self-sufficient by setting up memory page assignment
|
/// This makes the program self-sufficient by setting up memory page assignment
|
||||||
/// and copying the arguments to RAM.
|
/// and copying the arguments to RAM.
|
||||||
|
|
@ -344,7 +354,10 @@ pub fn read_initial_config(cfg: &mut BootConfig) {
|
||||||
assert!(!kernel_seen, "kernel appears twice");
|
assert!(!kernel_seen, "kernel appears twice");
|
||||||
assert!(tag.size as usize == mem::size_of::<ProgramDescription>(), "invalid XKrn size");
|
assert!(tag.size as usize == mem::size_of::<ProgramDescription>(), "invalid XKrn size");
|
||||||
kernel_seen = true;
|
kernel_seen = true;
|
||||||
} else if tag.name == u32::from_le_bytes(*b"IniE") || tag.name == u32::from_le_bytes(*b"IniF") {
|
} else if tag.name == u32::from_le_bytes(*b"IniE")
|
||||||
|
|| tag.name == u32::from_le_bytes(*b"IniF")
|
||||||
|
|| tag.name == u32::from_le_bytes(*b"IniS")
|
||||||
|
{
|
||||||
assert!(tag.size >= 4, "invalid Init size");
|
assert!(tag.size >= 4, "invalid Init size");
|
||||||
init_seen = true;
|
init_seen = true;
|
||||||
cfg.init_process_count += 1;
|
cfg.init_process_count += 1;
|
||||||
|
|
@ -467,6 +480,11 @@ fn check_load(cfg: &mut BootConfig) {
|
||||||
println!("\n\nChecking IniF region");
|
println!("\n\nChecking IniF region");
|
||||||
inif.check(cfg, inif.load_offset as usize, pid, true);
|
inif.check(cfg, inif.load_offset as usize, pid, true);
|
||||||
pid += 1;
|
pid += 1;
|
||||||
|
} else if tag.name == u32::from_le_bytes(*b"IniS") {
|
||||||
|
let inis = MiniElf::new(&tag);
|
||||||
|
println!("\n\nChecking IniS region");
|
||||||
|
inis.check(cfg, inis.load_offset as usize, pid, true);
|
||||||
|
pid += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue