From 96f0109e8ccef78a496ca769a745fe384ebbb106 Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Fri, 9 Aug 2024 02:29:31 -0700 Subject: [PATCH] crates/microkit: Add index getter functions Signed-off-by: Nick Spinale --- crates/sel4-microkit/base/src/channel.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/sel4-microkit/base/src/channel.rs b/crates/sel4-microkit/base/src/channel.rs index 3aa54d7bf..8d8219219 100644 --- a/crates/sel4-microkit/base/src/channel.rs +++ b/crates/sel4-microkit/base/src/channel.rs @@ -27,6 +27,10 @@ impl Channel { Self { index } } + pub const fn index(&self) -> usize { + self.index + } + fn cap(&self, base_slot: usize) -> sel4::Cap { sel4::Cap::from_bits((base_slot + self.index) as sel4::CPtrBits) } @@ -92,6 +96,10 @@ impl Child { Self { index } } + pub const fn index(&self) -> usize { + self.index + } + #[doc(hidden)] pub fn tcb(&self) -> sel4::cap::Tcb { sel4::Cap::from_bits((BASE_TCB_SLOT + self.index) as sel4::CPtrBits)