1
0
mirror of https://github.com/AmbiML/sparrow-kata-full.git synced 2025-05-10 08:25:19 +00:00

sel4bundle: fix application CNode guard setup

Change-Id: Ie53663d223ecc25633cb41c77b1a189570f0a7e8
GitOrigin-RevId: 612dd66db3952d94e25d0e46ca2cdeffec8c2e78
This commit is contained in:
Sam Leffler 2022-09-16 17:52:48 +00:00
parent 5683ba6e20
commit ecf7592adb

View File

@ -44,6 +44,7 @@ use io::Read;
use kata_io as io;
use sel4_sys::seL4_ASIDPool_Assign;
use sel4_sys::seL4_CNode_CapData;
use sel4_sys::seL4_CNode_Move;
use sel4_sys::seL4_CPtr;
use sel4_sys::seL4_CapRights;
@ -118,9 +119,8 @@ const_assert!(seL4_WordBits == 32 || seL4_WordBits == 64);
// Constructs a CSpace guard word from bits & size (see the seL4 manual
// for an explanation of how this is used).
// TODO(sleffler): move to sel4-sys because it exposes internals
fn make_guard(guard_bits: seL4_Word, guard_size: seL4_Word) -> seL4_Word {
((guard_bits) & ((1 << 18) - 1)) | ((guard_size << 18) | ((1 << 4) - 1))
seL4_CNode_CapData::new(guard_bits, guard_size).words[0]
}
fn roundup(a: usize, b: usize) -> usize { ((a + b - 1) / b) * b }
@ -309,7 +309,7 @@ impl seL4BundleImpl {
stack_base: 0,
// 1-level CSpace addressing
cspace_root_data: make_guard(seL4_WordBits - cspace_root_depth, 0),
cspace_root_data: make_guard(0, seL4_WordBits - cspace_root_depth),
cspace_root_depth: cspace_root_depth as u8,
vspace_root_data: make_guard(0, 0), // XXX unclear effect, need to investigate