From e490b6343abd9c9cf3c75e1b1da1de3bd4af6358 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Tue, 7 Mar 2023 20:17:09 +0100 Subject: [PATCH] kernel/arm64: align interrupt postlude with other architectures Change-Id: I0a5325f163d2ca99bfdaa35d7addedcfdc16ff9a Reviewed-on: https://review.haiku-os.org/c/haiku/+/6178 Reviewed-by: waddlesplash Tested-by: Commit checker robot --- src/system/kernel/arch/arm64/arch_int.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/arch/arm64/arch_int.cpp b/src/system/kernel/arch/arm64/arch_int.cpp index 07f4ab9c97..e8a4be7142 100644 --- a/src/system/kernel/arch/arm64/arch_int.cpp +++ b/src/system/kernel/arch/arm64/arch_int.cpp @@ -175,10 +175,22 @@ void after_exception() { Thread* thread = thread_get_current_thread(); + cpu_status state = disable_interrupts(); if (thread->cpu->invoke_scheduler) { - disable_interrupts(); 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); } }