From 8b340d5faff8e4ad5cbc74a4da041e2ed7b669f6 Mon Sep 17 00:00:00 2001 From: Mathieu Mirmont Date: Fri, 13 Dec 2024 20:32:24 +0100 Subject: [PATCH] tool/microkit: fix SchedContext allocation size 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 --- tool/microkit/src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tool/microkit/src/main.rs b/tool/microkit/src/main.rs index 63cd3b35..2fc62a59 100644 --- a/tool/microkit/src/main.rs +++ b/tool/microkit/src/main.rs @@ -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); }