mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
chore: irq: rename IRQ_INVALID
This commit is contained in:
parent
08f9374c8b
commit
6336693e34
@ -16,7 +16,7 @@ unsafe extern "C" fn _start(hart_id: usize, fdt_addr: usize) -> ! {
|
||||
// we should be launched by OpenSBI and running is S-mode
|
||||
|
||||
// 128 KiB stack for debugging only
|
||||
const STACK_SIZE: usize = 4096 * 32;
|
||||
const STACK_SIZE: usize = 4096 * 32; // at least 21, TODO: figure out why we need sooo much stack
|
||||
#[link_section = ".bss.boot_stack"]
|
||||
static mut STACK: [u8; STACK_SIZE] = [0u8; STACK_SIZE];
|
||||
|
||||
|
@ -6,7 +6,7 @@ use fdt::{node::FdtNode, Fdt};
|
||||
use log::trace;
|
||||
use spin::Mutex;
|
||||
|
||||
const IRQ_INVALID: usize = u32::MAX as usize;
|
||||
const IRQ_OCCUPIED: usize = u32::MAX as usize; // OpenSBI will rewrite IRQ_M_EXT to this value
|
||||
const IRQ_S_EXT: usize = 9;
|
||||
const IRQ_M_EXT: usize = 11;
|
||||
|
||||
@ -62,7 +62,7 @@ impl Driver for IrqPlic {
|
||||
let phandle = ctx.phandle; // cpu intc
|
||||
let irq = ctx.interrupts().next().unwrap(); // IRQ_M_EXT/IRQ_S_EXT
|
||||
|
||||
if irq == IRQ_INVALID {
|
||||
if irq == IRQ_OCCUPIED {
|
||||
trace!("[IrqPlic] context {} taken by SBI", i);
|
||||
continue;
|
||||
}
|
||||
|
@ -23,3 +23,12 @@ pub struct IrqManager {
|
||||
state: [IrqState; IRQ_NUM],
|
||||
}
|
||||
|
||||
impl IrqManager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
handler: core::array::from_fn::<_, IRQ_NUM, _>(|_| CapEntry::new(NullCap::mint())),
|
||||
state: [IrqState::Inactive; IRQ_NUM],
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user