From ecf7592adbe9554fb0c86b53cff7aabbb8758858 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 16 Sep 2022 17:52:48 +0000 Subject: [PATCH] sel4bundle: fix application CNode guard setup Change-Id: Ie53663d223ecc25633cb41c77b1a189570f0a7e8 GitOrigin-RevId: 612dd66db3952d94e25d0e46ca2cdeffec8c2e78 --- .../ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs b/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs index 453121c..57c03a7 100644 --- a/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs +++ b/apps/system/components/ProcessManager/kata-proc-manager/src/sel4bundle/mod.rs @@ -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