From 1b0f694aaf3a88ed0bdcd4aae14bc5b57fd0862b Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Thu, 28 Jul 2022 14:29:48 +0000 Subject: [PATCH] Merge "capdl: add CDL_ObjID_Invalid" GitOrigin-RevId: 57f22db2fddaa9c3d8fd8024cf3ea6411b81daef --- apps/system/components/kata-os-common/src/capdl/mod.rs | 3 ++- .../kata-os-common/src/model/feature/dynamic_alloc.rs | 4 ++-- apps/system/components/kata-os-common/src/model/mod.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/system/components/kata-os-common/src/capdl/mod.rs b/apps/system/components/kata-os-common/src/capdl/mod.rs index e3c2bb1..e919716 100644 --- a/apps/system/components/kata-os-common/src/capdl/mod.rs +++ b/apps/system/components/kata-os-common/src/capdl/mod.rs @@ -132,9 +132,10 @@ pub const CDL_TCB_TemporalFaultEP_Slot: seL4_Word = CDL_TCB_SC_Slot + 1; pub const CDL_TCB_VCPU_Slot: seL4_Word = CDL_TCB_TemporalFaultEP_Slot + 1; pub type CDL_ObjID = seL4_Word; +pub const CDL_ObjID_Invalid: CDL_ObjID = CDL_ObjID::MAX; // NB: some object id's are written in the spec as -1 pub fn is_objid_valid(val: CDL_ObjID) -> bool { - val != CDL_ObjID::MAX + val != CDL_ObjID_Invalid } pub type CDL_IRQ = seL4_Word; pub type CDL_Core = seL4_Word; diff --git a/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs b/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs index 0d83209..c7f292c 100644 --- a/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs +++ b/apps/system/components/kata-os-common/src/model/feature/dynamic_alloc.rs @@ -59,8 +59,8 @@ impl<'a> KataOsModel<'a> { let mut roots = SmallVec::new(); // Record objects that receive special treatment later on. - let mut bootinfo_frame: CDL_ObjID = CDL_ObjID::MAX; - let mut untyped_cnode: CDL_ObjID = CDL_ObjID::MAX; + let mut bootinfo_frame: CDL_ObjID = CDL_ObjID_Invalid; + let mut untyped_cnode: CDL_ObjID = CDL_ObjID_Invalid; // First, allocate most objects and record the cslot locations. // The exception is ASIDPools, where create_object only allocates diff --git a/apps/system/components/kata-os-common/src/model/mod.rs b/apps/system/components/kata-os-common/src/model/mod.rs index 39da83e..15ea3e7 100644 --- a/apps/system/components/kata-os-common/src/model/mod.rs +++ b/apps/system/components/kata-os-common/src/model/mod.rs @@ -187,7 +187,7 @@ impl<'a> KataOsModel<'a> { #[cfg(feature = "CONFIG_ARM_SMMU")] sid_number: 0, - untyped_cnode: CDL_ObjID::MAX, + untyped_cnode: CDL_ObjID_Invalid, untyped_index: 0, untyped_max: 0, @@ -291,7 +291,7 @@ impl<'a> KataOsModel<'a> { let mut ut_index = self.untyped_index; while let Err(e) = self.create_object( &cnode, - CDL_ObjID::MAX, // NB: use something invalid in case it's used + CDL_ObjID_Invalid, self.state.get_untyped_cptr(ut_index), cnode_slot, ) {