kata-os-model: correct slot calculation for untyped memory handoff

When calculating the landing spot for handing off the UntypedMemory
objects we need to take into account empty slots. Calculate the max
occupied slot # and add one. This works so long as empty slots have
not been allocated (by CAmkES) at the end of the CNode--which should
be safe since we control the MemoryManager CAmkES specification.

Change-Id: I5bfb75bd7134254c4475a91653d54e2aeb126721
GitOrigin-RevId: cf14850894ad21be97ea094f977c3420edf322ab
This commit is contained in:
Sam Leffler 2022-04-08 15:56:51 +00:00
parent 18c7660244
commit c0549c75e7

View File

@ -934,7 +934,11 @@ impl<'a> KataOsModel<'a> {
let num_untypeds = self.bootinfo.untyped.end - self.bootinfo.untyped.start;
// NB: UntypedMemory caps are appended to the CAmkES-generated slots
let dest_start = self.spec.obj_slice()[cnode_obj_id].num_slots() + 1;
let dest_start = self.spec.obj_slice()[cnode_obj_id]
.slots_slice()
.iter()
.max_by_key(|slot| slot.slot)
.map_or(0, |slot| slot.slot + 1);
info!("Hand-off {} untypeds from {} to {}",
num_untypeds,