Skip to content

Commit

Permalink
tool/microkit: fix SchedContext allocation size
Browse files Browse the repository at this point in the history
When creating CNodes, the `size` is the (log2) number of CSlots. When
creating SchedContexts the `size` is the (log2) size of the object in
bytes.

Signed-off-by: Mathieu Mirmont <[email protected]>
  • Loading branch information
matneutrality committed Dec 17, 2024
1 parent 9bc4568 commit 8b340d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tool/microkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ impl<'a> InitSystem<'a> {
let sz = size.unwrap();
assert!(util::is_power_of_two(sz));
api_size = sz.ilog2() as u64;
alloc_size = sz * SLOT_SIZE;
if object_type == ObjectType::CNode {
alloc_size = sz * SLOT_SIZE;
} else {
alloc_size = sz;
}
} else {
panic!("Internal error: invalid object type: {:?}", object_type);
}
Expand Down

0 comments on commit 8b340d5

Please sign in to comment.