Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/sel4-capdl-initializer/src/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,20 @@ impl<'a> Initializer<'a> {
)?;

tcb.tcb_set_timeout_endpoint(temp_fault_ep)?;

if obj.extra.passive {
if let Some(bound_sc) = obj.sc() {
if let Some(bound_ntfn) = obj.bound_notification() {
let bound_ntfn_cap =
self.orig_cap::<cap_type::Notification>(bound_ntfn.object);
sc.bind_ntfn(bound_ntfn_cap)?;
} else {
panic!("A passive task must have its own Notification.");
}
} else {
panic!("A passive task must have its own Scheduling Context.");
}
}
} else {
let fault_ep = sel4::CPtr::from_bits(obj.extra.master_fault_ep.as_ref().unwrap().to_sel4());

Expand Down
2 changes: 2 additions & 0 deletions crates/sel4-capdl-initializer/types/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ pub mod object {
pub gprs: Vec<Word>,

pub master_fault_ep: Option<Word>,

pub passive: bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this flag necessary? Could we just bind the nfn to the sc whenever a tcb has both a nfn and a sc?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems wrong; an active server would both have a TCB, SC, and a notification but shouldn't have the SC bound to the notification for lazy rebind. Unless you mean something else?

(But yes this would also need changing in the C capDL spec)

@midnightveil midnightveil Jul 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could've sworn I left another comment but I feel like there should be a way to ask for "SC bound to NTFN" in the spec more generally; which is what this is wanting.

(paasive w/lazy rebind = SC bound to TCB and SC bound to NTFN, and the TCB has ability to block on that notification; no need for an extra passive attribute...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we give a pub slots: Vec<CapTableEntry> to the NTFN object in the spec, if there is a SC cap in that Vec then do the passive with lazy rebind?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely binding ntfn to SC exists in the capDL spec?

(If not this should also be discussed on the C/Haskell repo as there are other stakeholders here)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made an issue in the C/Haskell repo here: seL4/capdl#96

}

#[derive(Debug, Clone, Eq, PartialEq, IsObject, HasCapTable)]
Expand Down
9 changes: 9 additions & 0 deletions crates/sel4/src/invocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,15 @@ impl<C: InvocationContext> SchedControl<C> {

#[sel4_cfg(KERNEL_MCS)]
impl<C: InvocationContext> SchedContext<C> {
/// Corresponds to `seL4_SchedContext_Bind`.
pub fn bind_ntfn(self, notification: Notification) -> Result<()> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename this to sched_context_bind() to match the convention of the file?

Also, while you're at it, could you also rename unbind below to sched_context_unbind()?

Error::wrap(self.invoke(|cptr, ipc_buffer| {
ipc_buffer
.inner_mut()
.seL4_SchedContext_Bind(cptr.bits(), notification.bits())
}))
}

/// Corresponds to `seL4_SchedContext_Unbind`.
pub fn unbind(self) -> Result<()> {
Error::wrap(self.invoke(|cptr, ipc_buffer| {
Expand Down
Loading