diff --git a/src/arch/aarch64/mod.rs b/src/arch/aarch64/mod.rs index ecad74e..a5faaec 100644 --- a/src/arch/aarch64/mod.rs +++ b/src/arch/aarch64/mod.rs @@ -30,6 +30,12 @@ impl cap_arch_func for cap { // cap_tag::CapPageGlobalDirectoryCap => self.get_pgd_base_ptr(), cap_tag::cap_asid_control_cap => 0, cap_tag::cap_asid_pool_cap => cap::cap_asid_pool_cap(self).get_capASIDPool() as usize, + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_reply_cap => cap::cap_reply_cap(self).get_capReplyPtr() as usize, + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_sched_context_cap => { + cap::cap_sched_context_cap(self).get_capSCPtr() as usize + } _ => 0, } } diff --git a/src/arch/riscv64/mod.rs b/src/arch/riscv64/mod.rs index bcba870..dd70d13 100644 --- a/src/arch/riscv64/mod.rs +++ b/src/arch/riscv64/mod.rs @@ -30,6 +30,12 @@ impl cap_arch_func for cap { cap::cap_page_table_cap(self).get_capPTBasePtr() as usize } cap_tag::cap_asid_pool_cap => cap::cap_asid_pool_cap(self).get_capASIDPool() as usize, + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_reply_cap => cap::cap_reply_cap(self).get_capReplyPtr() as usize, + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_sched_context_cap => { + cap::cap_sched_context_cap(self).get_capSCPtr() as usize + } _ => 0, } } diff --git a/src/capability/mod.rs b/src/capability/mod.rs index a4a80e5..d1393fd 100644 --- a/src/capability/mod.rs +++ b/src/capability/mod.rs @@ -109,23 +109,47 @@ impl cap_func for cap { cap_tag::cap_reply_cap => seL4_ReplyBits, #[cfg(not(feature = "KERNEL_MCS"))] cap_tag::cap_reply_cap => 0, + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_sched_context_cap => { + cap::cap_sched_context_cap(self).get_capSCSizeBits() as usize + } _ => 0, } } fn get_cap_is_physical(&self) -> bool { - matches!( - self.get_tag(), - cap_tag::cap_untyped_cap - | cap_tag::cap_endpoint_cap - | cap_tag::cap_notification_cap - | cap_tag::cap_cnode_cap - | cap_tag::cap_frame_cap - | cap_tag::cap_asid_pool_cap - | cap_tag::cap_page_table_cap - | cap_tag::cap_zombie_cap - | cap_tag::cap_thread_cap - ) + #[cfg(not(feature = "KERNEL_MCS"))] + { + matches!( + self.get_tag(), + cap_tag::cap_untyped_cap + | cap_tag::cap_endpoint_cap + | cap_tag::cap_notification_cap + | cap_tag::cap_cnode_cap + | cap_tag::cap_frame_cap + | cap_tag::cap_asid_pool_cap + | cap_tag::cap_page_table_cap + | cap_tag::cap_zombie_cap + | cap_tag::cap_thread_cap + ) + } + #[cfg(feature = "KERNEL_MCS")] + { + matches!( + self.get_tag(), + cap_tag::cap_untyped_cap + | cap_tag::cap_endpoint_cap + | cap_tag::cap_notification_cap + | cap_tag::cap_cnode_cap + | cap_tag::cap_frame_cap + | cap_tag::cap_asid_pool_cap + | cap_tag::cap_page_table_cap + | cap_tag::cap_zombie_cap + | cap_tag::cap_thread_cap + | cap_tag::cap_sched_context_cap + | cap_tag::cap_reply_cap + ) + } } fn isArchCap(&self) -> bool { @@ -186,6 +210,31 @@ pub fn same_region_as(cap1: &cap, cap2: &cap) -> bool { } false } + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_sched_context_cap => { + if cap2.get_tag() == cap_tag::cap_sched_context_cap { + return (cap::cap_sched_context_cap(cap1).get_capSCPtr() + == cap::cap_sched_context_cap(cap2).get_capSCPtr()) + && (cap::cap_sched_context_cap(cap1).get_capSCSizeBits() + == cap::cap_sched_context_cap(cap2).get_capSCSizeBits()); + } + false + } + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_sched_control_cap => { + if cap2.get_tag() == cap_tag::cap_sched_control_cap { + return true; + } + false + } + #[cfg(feature = "KERNEL_MCS")] + cap_tag::cap_reply_cap => { + if cap2.get_tag() == cap_tag::cap_reply_cap { + return cap::cap_reply_cap(cap1).get_capReplyPtr() + == cap::cap_reply_cap(cap2).get_capReplyPtr(); + } + false + } _ => false, } }