From f610cb7baa26b2803fce8b6e4604e8639c71d1d3 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 28 Feb 2015 11:25:12 +0100 Subject: IRQ handlers must be written with caution! --- src/kernel/include/idt.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/kernel/include') diff --git a/src/kernel/include/idt.h b/src/kernel/include/idt.h index d9dd927..2cccfa5 100644 --- a/src/kernel/include/idt.h +++ b/src/kernel/include/idt.h @@ -74,6 +74,16 @@ void idt_init(); void idt_set_ex_handler(int number, isr_handler_t func); //Set exception handler void idt_set_irq_handler(int number, isr_handler_t func); //Set IRQ handler +// Warning about IRQ handlers : +// IRQ handlers must not call yield(), because that may not return ! Therefore they cannot +// use mutexes, memory allocation and most usefull things. Basically the only thing they +// can do is wake up another thread, so it is a good idea to have a thread that waits for +// the IRQ and does something when it happens, and the IRQ handler only wakes up that thread +// when the IRQ happens. +// Remark on resume_thread : if the second argument is set to true, yield() is called in the +// function, so it may never return in some circumstances +// IRQ handlers are never preemptible + void dbg_dump_registers(registers_t*); /* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3