From b1994dbe160bbd35d04337c62b740ea9bc7d036c Mon Sep 17 00:00:00 2001 From: morgan Date: Wed, 6 Mar 2024 16:00:58 +0800 Subject: [PATCH] abort: support custom exception vector table addr --- libsupport_zynq/src/abort.rs | 10 +++++++--- libsupport_zynq/src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libsupport_zynq/src/abort.rs b/libsupport_zynq/src/abort.rs index 20279f4..f4e94d5 100644 --- a/libsupport_zynq/src/abort.rs +++ b/libsupport_zynq/src/abort.rs @@ -1,6 +1,10 @@ -use libregister::RegisterR; -use libcortex_a9::{regs::{DFSR, MPIDR}, interrupt_handler}; -use libboard_zynq::{println, stdio}; +use libregister::{RegisterR, RegisterW}; +use libcortex_a9::{regs::{DFSR, MPIDR, VBAR}, interrupt_handler}; +use libboard_zynq::{println, stdio}; + +pub fn set_vector_table(base_addr: u32){ + VBAR.write(base_addr); +} interrupt_handler!(UndefinedInstruction, undefined_instruction, __irq_stack0_start, __irq_stack1_start, { stdio::drop_uart(); diff --git a/libsupport_zynq/src/lib.rs b/libsupport_zynq/src/lib.rs index b84e7d7..9ab0ea0 100644 --- a/libsupport_zynq/src/lib.rs +++ b/libsupport_zynq/src/lib.rs @@ -9,7 +9,7 @@ pub extern crate alloc; pub extern crate compiler_builtins; pub mod boot; -mod abort; +pub mod abort; #[cfg(feature = "panic_handler")] mod panic; pub mod ram;