Skip to content

Commit

Permalink
crates/microkit: Add index getter functions
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Aug 9, 2024
1 parent fe6fdd6 commit 96f0109
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/sel4-microkit/base/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ impl Channel {
Self { index }
}

pub const fn index(&self) -> usize {
self.index
}

fn cap<T: sel4::CapType>(&self, base_slot: usize) -> sel4::Cap<T> {
sel4::Cap::from_bits((base_slot + self.index) as sel4::CPtrBits)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 96f0109

Please sign in to comment.