feat: added support for waiting on an irq
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <drivers/ports.h>
|
||||
#include <libc/kprintf.h>
|
||||
#include <libk/libk.h>
|
||||
#include <tasks/task.h>
|
||||
|
||||
#define PIC_END_OF_INTERRUPT 0x20
|
||||
|
||||
@@ -142,6 +143,9 @@ void irq_handler(isr_registers_t r) {
|
||||
if (r.int_no >= 40) port_byte_out(PORT_PIC_SLAVE_COMMAND, PIC_END_OF_INTERRUPT); /* slave */
|
||||
port_byte_out(PORT_PIC_MASTER_COMMAND, PIC_END_OF_INTERRUPT); /* master */
|
||||
|
||||
if (r.int_no >= IRQ0 && r.int_no < IRQ15) {
|
||||
task_notify_irq(r.int_no - IRQ0);
|
||||
}
|
||||
/* Handle the interrupt in a more modular way */
|
||||
if (interrupt_handlers[r.int_no] != NULL) {
|
||||
isr_t handler = interrupt_handlers[r.int_no];
|
||||
|
||||
@@ -14,6 +14,8 @@ void syscall_handle(isr_registers_t *registers) {
|
||||
case SYSCALL_YIELD_JOB:
|
||||
task_switch_next();
|
||||
break;
|
||||
case SYSCALL_YIELD_IRQ:
|
||||
task_wait_irq(registers->ebx);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user