sel4_sys/syscalls/helpers/
mod.rs

1//
2// Copyright 2023, Colias Group, LLC
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6
7use crate::bf::SeL4Bitfield;
8
9use crate::{seL4_MessageInfo, seL4_Word};
10
11mod arch;
12
13pub use arch::*;
14
15impl seL4_MessageInfo {
16    pub(crate) fn from_word(word: seL4_Word) -> Self {
17        Self(SeL4Bitfield::new([word]))
18    }
19
20    pub(crate) fn into_word(self) -> seL4_Word {
21        self.0.into_inner()[0]
22    }
23
24    pub(crate) fn msg_helper(&self, msg: Option<seL4_Word>, i: seL4_Word) -> seL4_Word {
25        match msg {
26            Some(msg) if i < self.get_length() => msg,
27            _ => 0,
28        }
29    }
30}