From 65aab788e64efd684ddccb8a034c91e350805650 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Mon, 25 Oct 2021 16:06:02 +0200 Subject: [PATCH] kernel/arch/arm/int: add irq postlude Change-Id: If3dcd2f7d3c0385ecc699b4de4359a14a189fff0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4673 Tested-by: Commit checker robot Reviewed-by: Fredrik Holmqvist --- src/system/kernel/arch/arm/arch_int.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/system/kernel/arch/arm/arch_int.cpp b/src/system/kernel/arch/arm/arch_int.cpp index 9a5f929c4f..3bb5c2c80a 100644 --- a/src/system/kernel/arch/arm/arch_int.cpp +++ b/src/system/kernel/arch/arm/arch_int.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -343,6 +344,25 @@ arch_arm_irq(struct iframe *iframe) InterruptController *ic = InterruptController::Get(); if (ic != NULL) ic->HandleInterrupt(); + + Thread* thread = thread_get_current_thread(); + cpu_status state = disable_interrupts(); + if (thread->cpu->invoke_scheduler) { + SpinLocker schedulerLocker(thread->scheduler_lock); + scheduler_reschedule(B_THREAD_READY); + schedulerLocker.Unlock(); + restore_interrupts(state); + } else if (thread->post_interrupt_callback != NULL) { + void (*callback)(void*) = thread->post_interrupt_callback; + void* data = thread->post_interrupt_data; + + thread->post_interrupt_callback = NULL; + thread->post_interrupt_data = NULL; + + restore_interrupts(state); + + callback(data); + } }