1
0
Fork 0

fix exception vectors

This commit is contained in:
Sebastien Bourdeauducq 2020-07-06 21:02:46 +08:00
parent 0c60d684e4
commit e430600683
3 changed files with 53 additions and 16 deletions

View File

@ -1,14 +1,4 @@
ENTRY(_boot_cores); ENTRY(Reset);
/* Provide some defaults */
PROVIDE(Reset = _boot_cores);
PROVIDE(UndefinedInstruction = Reset);
PROVIDE(SoftwareInterrupt = Reset);
PROVIDE(PrefetchAbort = Reset);
PROVIDE(DataAbort = Reset);
PROVIDE(ReservedException = Reset);
PROVIDE(IRQ = Reset);
PROVIDE(FIQ = Reset);
MEMORY MEMORY
{ {

View File

@ -2,16 +2,36 @@ use libregister::RegisterR;
use libcortex_a9::regs::{DFSR, MPIDR}; use libcortex_a9::regs::{DFSR, MPIDR};
use libboard_zynq::{println, slcr, stdio}; use libboard_zynq::{println, slcr, stdio};
#[link_section = ".text.boot"]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn PrefetchAbort() { #[naked]
pub unsafe extern "C" fn UndefinedInstruction() {
stdio::drop_uart(); stdio::drop_uart();
println!("UndefinedInstruction");
println!("PrefetchAbort");
loop {} loop {}
} }
#[link_section = ".text.boot"]
#[no_mangle] #[no_mangle]
#[naked]
pub unsafe extern "C" fn SoftwareInterrupt() {
stdio::drop_uart();
println!("SoftwareInterrupt");
loop {}
}
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn PrefetchAbort() {
stdio::drop_uart();
println!("PrefetchAbort");
loop {}
}
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn DataAbort() { pub unsafe extern "C" fn DataAbort() {
stdio::drop_uart(); stdio::drop_uart();
@ -21,3 +41,30 @@ pub unsafe extern "C" fn DataAbort() {
loop {} loop {}
} }
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn ReservedException() {
stdio::drop_uart();
println!("ReservedException");
loop {}
}
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn IRQ() {
stdio::drop_uart();
println!("IRQ");
loop {}
}
#[link_section = ".text.boot"]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn FIQ() {
stdio::drop_uart();
println!("FIQ");
loop {}
}

View File

@ -21,7 +21,7 @@ static mut CORE1_ENABLED: VolatileCell<bool> = VolatileCell::new(false);
#[link_section = ".text.boot"] #[link_section = ".text.boot"]
#[no_mangle] #[no_mangle]
#[naked] #[naked]
pub unsafe extern "C" fn _boot_cores() -> ! { pub unsafe extern "C" fn Reset() -> ! {
const CORE_MASK: u32 = 0x3; const CORE_MASK: u32 = 0x3;
match MPIDR.read() & CORE_MASK { match MPIDR.read() & CORE_MASK {