aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/int.c
diff options
context:
space:
mode:
authorMarvin Borner2021-07-01 21:13:01 +0200
committerMarvin Borner2021-07-01 22:32:16 +0200
commitf3e85eedc434da973267f360abdbb79cb6f24100 (patch)
tree9fd71ec70454474a0a2cff479c7d9b949e779c74 /kernel/drivers/int.c
parent340e841772eb13d9087235b8707c1cfeff8710cb (diff)
Timing is everything
Diffstat (limited to 'kernel/drivers/int.c')
-rw-r--r--kernel/drivers/int.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/kernel/drivers/int.c b/kernel/drivers/int.c
index f6a5134..d5f0a67 100644
--- a/kernel/drivers/int.c
+++ b/kernel/drivers/int.c
@@ -172,19 +172,32 @@ static u32 int_special_handler(struct int_frame *frame)
* Universal handler
*/
+static u8 int_enabled = 1;
+
u32 int_handler(u32 esp);
u32 int_handler(u32 esp)
{
struct int_frame *frame = (struct int_frame *)esp;
- if (frame->int_no < 32)
+ if (frame->int_no < 32) {
int_trap_handler(frame);
- else if (frame->int_no < 48)
+ } else if (int_enabled && frame->int_no < 48) {
esp = int_event_handler(frame);
- else if (frame->int_no >= 128 && frame->int_no < 144)
+ } else if (frame->int_no >= 128 && frame->int_no < 144) {
esp = int_special_handler(frame);
- else
+ } else if (frame->int_no >= 48) {
panic("Unknown interrupt: %d\n", frame->int_no);
+ }
pic_ack(frame->int_no);
return esp;
}
+
+void int_disable(void)
+{
+ int_enabled = 0;
+}
+
+void int_enable(void)
+{
+ int_enabled = 1;
+}