|
45 | 45 | //! execution. Theon will locate them, and load them into |
46 | 46 | //! physical memory. |
47 | 47 | //! |
48 | | -//! Each binary is allocated a 16MiB region of physical RAM for |
49 | | -//! its various pages; these regions begin at 64MiB and are |
50 | | -//! aligned on 32MiB boundaries, giving us room for loading new |
51 | | -//! images into the second 16MiBs of each binary's region for |
| 48 | +//! Each binary is allocated an 8MiB region of physical RAM for |
| 49 | +//! its various pages; these regions begin at 16MiB and are |
| 50 | +//! aligned on 16MiB boundaries, giving us room for loading new |
| 51 | +//! images into the second 8MiBs of each binary's region for |
52 | 52 | //! hitless update. |
53 | 53 | //! |
54 | 54 | //! Binaries represent either tasks or segments; see HDP 0002 |
@@ -104,13 +104,13 @@ enum BinaryType { |
104 | 104 | /// or a task). |
105 | 105 | type BinaryMeta = (&'static str, HPA, BinaryType); |
106 | 106 |
|
107 | | -/// Binaries are loaded in 16MiB regions of physical memory |
108 | | -/// that are aligned on 32MiB boundaries, starting at 64MiB. |
| 107 | +/// Binaries are loaded in 8MiB regions of physical memory |
| 108 | +/// that are aligned on 16MiB boundaries, starting at 16MiB. |
109 | 109 | const fn load_addr(offset: usize) -> HPA { |
110 | | - let addr = (64 + offset * 32) * MIB; |
| 110 | + let addr = (16 + offset * 16) * MIB; |
111 | 111 | HPA::new(addr as u64) |
112 | 112 | } |
113 | | -const BINARY_IMAGE_MEMORY_SIZE: usize = 16 * MIB; |
| 113 | +const BINARY_IMAGE_MEMORY_SIZE: usize = 8 * MIB; |
114 | 114 |
|
115 | 115 | /// A table description all the binaries that are loaded by |
116 | 116 | /// theon, where to load them in physical memory, and their |
@@ -157,10 +157,12 @@ pub extern "C" fn main(mbinfo_phys: u64) -> ! { |
157 | 157 | let archive = goblin::archive::Archive::parse(bins.bytes).expect("cannot parse bin.a"); |
158 | 158 | uart::panic_println!("Binary archive: {:#x?}", archive); |
159 | 159 | clear_binary_load_region(); |
| 160 | + let mut roots = alloc::vec::Vec::with_capacity(BINARY_TABLE.len()); |
160 | 161 | for &(name, addr, typ) in BINARY_TABLE { |
161 | 162 | let bytes = archive.extract(name, bins.bytes).expect("cannot extract elf"); |
162 | 163 | let region_end = addr.offset(BINARY_IMAGE_MEMORY_SIZE); |
163 | | - load(name, typ, bytes, addr..region_end).expect("loaded binary"); |
| 164 | + let root = load(name, typ, bytes, addr..region_end).expect("loaded binary"); |
| 165 | + roots.push((name, root)); |
164 | 166 | } |
165 | 167 | unsafe { core::arch::asm!("int3") }; |
166 | 168 | // Start other CPUs. |
|
0 commit comments