From e27755971a4472b85383f1fa35b5e30d50b4fdb8 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Wed, 12 Apr 2023 16:48:09 +0100 Subject: [PATCH] Acknowledge and log interrupt. We should end it as well, but doing so results in a loop unless we first clear the match. --- src/exercises/bare-metal/rtc/src/exceptions.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/exercises/bare-metal/rtc/src/exceptions.rs b/src/exercises/bare-metal/rtc/src/exceptions.rs index 18d7b846..4a16f1b6 100644 --- a/src/exercises/bare-metal/rtc/src/exceptions.rs +++ b/src/exercises/bare-metal/rtc/src/exceptions.rs @@ -12,7 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use log::error; +use crate::gicv3::GicV3; +use log::{error, info, trace}; use psci::system_off; #[no_mangle] @@ -23,8 +24,9 @@ extern "C" fn sync_exception_current(_elr: u64, _spsr: u64) { #[no_mangle] extern "C" fn irq_current(_elr: u64, _spsr: u64) { - error!("irq_current"); - system_off().unwrap(); + trace!("irq_current"); + let intid = GicV3::get_and_acknowledge_interrupt().expect("No pending interrupt"); + info!("IRQ {intid:?}"); } #[no_mangle]