Skip to content
Merged
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
11 changes: 11 additions & 0 deletions src/kernel/arch/x86/arch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ pub fn haltNoInterrupts() noreturn {
halt();
}
}

///
/// Register an interrupt handler. The interrupt number should be the arch-specific number.
///
/// Arguments:
/// IN int: u16 - The arch-specific interrupt number to register for.
/// IN handler: fn (ctx: *InterruptContext) void - The handler to assign to the interrupt.
///
pub fn registerInterruptHandler(int: u16, handler: fn (ctx: *InterruptContext) void) void {
irq.registerIrq(int, handler);
}
9 changes: 9 additions & 0 deletions test/kernel/arch_mock.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ pub fn inb(port: u16) u8 {return 0;}
/// event being waited.
///
pub fn ioWait() void {}

///
/// Register an interrupt handler. The interrupt number should be the arch-specific number.
///
/// Arguments:
/// IN int: u16 - The arch-specific interrupt number to register for.
/// IN handler: fn (ctx: *InterruptContext) void - The handler to assign to the interrupt.
///
pub fn registerInterruptHandler(int: u16, ctx: fn (ctx: *InterruptContext) void) void {}