Skip to content

Commit

Permalink
capdl: set notification on x86 IRQ handlers
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Mar 2, 2024
1 parent 484bb4b commit b312f07
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/sel4-capdl-initializer/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,20 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject
.spec()
.filter_objects::<&object::ArmIrq>()
.map(|(obj_id, obj)| (obj_id, obj.notification()));
let msi_irq_notifications = self
.spec()
.filter_objects::<&object::IrqMsi>()
.map(|(obj_id, obj)| (obj_id, obj.notification()));
let ioapic_irq_notifications = self
.spec()
.filter_objects::<&object::IrqIOApic>()
.map(|(obj_id, obj)| (obj_id, obj.notification()));

for (obj_id, notification) in irq_notifications.chain(arm_irq_notifications) {
let all_irq_notifications = irq_notifications
.chain(arm_irq_notifications)
.chain(msi_irq_notifications)
.chain(ioapic_irq_notifications);
for (obj_id, notification) in all_irq_notifications {
let irq_handler = self.orig_cap::<cap_type::IrqHandler>(obj_id);
if let Some(logical_nfn_cap) = notification {
let nfn = match logical_nfn_cap.badge {
Expand Down
16 changes: 16 additions & 0 deletions crates/sel4-capdl-initializer/types/src/cap_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ impl<'a> object::ArmIrq<'a> {
}
}

impl<'a> object::IrqMsi<'a> {
pub const SLOT_NOTIFICATION: CapSlot = 0;

pub fn notification(&self) -> Option<&cap::Notification> {
self.maybe_slot_as(Self::SLOT_NOTIFICATION)
}
}

impl<'a> object::IrqIOApic<'a> {
pub const SLOT_NOTIFICATION: CapSlot = 0;

pub fn notification(&self) -> Option<&cap::Notification> {
self.maybe_slot_as(Self::SLOT_NOTIFICATION)
}
}

// // //

impl<'a> object::PageTable<'a> {
Expand Down

0 comments on commit b312f07

Please sign in to comment.