1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Interrupt handlers for the epilogue layer.
#![allow(unused)]

use super::guard::Guarded;

/// The different types of epilogues that can be deferred to the epilogue layer.
///
/// They are created in the interrupt service routines and enqueued for
/// execution by the `Guard`.
/// The so called "prologs" of the prologue/epilogue model are directly executed
/// In the ISR and are not part of this object.
#[derive(Debug, Clone)]
pub enum Epilogue {
    /// LAPIC Timer interrupt
    Timer,
    /// PS2 Keyboard interrupt
    Keyboard { key: char },
    /// Assassin IPI
    Assassin,
}

impl Epilogue {
    /// Possibly delayed, sequentially executed interrupt handling routine.
    pub fn run(&mut self, g: &mut Guarded) {
        match self {
            Self::Timer => timer(g),
            Self::Keyboard { key } => keyboard(g, *key),
            Self::Assassin => assassin(g),
        }
    }
}

/// Timer epilogue
fn timer(_g: &mut Guarded) {
    todo!("BSB A5");
    // TODO: BSB A6 - BellRinger
}

/// Keyboard epilogue
fn keyboard(_g: &mut Guarded, _key: char) {
    todo!("BSB A3")
}

/// Assassin epilogue
fn assassin(_g: &mut Guarded) {
    todo!("BSB A5")
}