2020-08-03 11:23:41 +08:00
|
|
|
use libregister::{RegisterR, RegisterW};
|
|
|
|
use libcortex_a9::regs::{DFSR, MPIDR, SP};
|
|
|
|
use libcortex_a9::asm;
|
|
|
|
use libboard_zynq::{println, stdio, gic, mpcore};
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
fn main_core1();
|
|
|
|
static mut __stack1_start: u32;
|
|
|
|
}
|
2019-11-11 09:37:06 +08:00
|
|
|
|
2020-07-06 21:02:46 +08:00
|
|
|
#[link_section = ".text.boot"]
|
2019-11-11 09:37:06 +08:00
|
|
|
#[no_mangle]
|
2020-07-06 21:02:46 +08:00
|
|
|
#[naked]
|
|
|
|
pub unsafe extern "C" fn UndefinedInstruction() {
|
2020-01-24 05:34:37 +08:00
|
|
|
stdio::drop_uart();
|
2020-07-06 21:02:46 +08:00
|
|
|
println!("UndefinedInstruction");
|
|
|
|
loop {}
|
|
|
|
}
|
2020-01-24 05:34:37 +08:00
|
|
|
|
2020-07-06 21:02:46 +08:00
|
|
|
#[link_section = ".text.boot"]
|
|
|
|
#[no_mangle]
|
|
|
|
#[naked]
|
|
|
|
pub unsafe extern "C" fn SoftwareInterrupt() {
|
|
|
|
stdio::drop_uart();
|
|
|
|
println!("SoftwareInterrupt");
|
|
|
|
loop {}
|
|
|
|
}
|
2020-01-24 05:45:05 +08:00
|
|
|
|
2020-07-06 21:02:46 +08:00
|
|
|
#[link_section = ".text.boot"]
|
|
|
|
#[no_mangle]
|
|
|
|
#[naked]
|
|
|
|
pub unsafe extern "C" fn PrefetchAbort() {
|
|
|
|
stdio::drop_uart();
|
|
|
|
println!("PrefetchAbort");
|
2019-11-11 09:37:06 +08:00
|
|
|
loop {}
|
|
|
|
}
|
|
|
|
|
2020-07-06 21:02:46 +08:00
|
|
|
#[link_section = ".text.boot"]
|
2019-11-11 09:37:06 +08:00
|
|
|
#[no_mangle]
|
2020-07-06 21:02:46 +08:00
|
|
|
#[naked]
|
2019-11-11 09:37:06 +08:00
|
|
|
pub unsafe extern "C" fn DataAbort() {
|
2020-01-24 05:34:37 +08:00
|
|
|
stdio::drop_uart();
|
|
|
|
|
2020-07-08 05:51:33 +08:00
|
|
|
println!("DataAbort on core {}", MPIDR.read().cpu_id());
|
2020-06-25 04:23:05 +08:00
|
|
|
println!("DFSR: {:03X}", DFSR.read());
|
2020-01-24 05:45:05 +08:00
|
|
|
|
2019-11-11 09:37:06 +08:00
|
|
|
loop {}
|
|
|
|
}
|
2020-07-06 21:02:46 +08:00
|
|
|
|
|
|
|
#[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() {
|
2020-08-03 11:23:41 +08:00
|
|
|
if MPIDR.read().cpu_id() == 1{
|
|
|
|
let mpcore = mpcore::RegisterBlock::new();
|
|
|
|
let mut gic = gic::InterruptController::new(mpcore);
|
|
|
|
let id = gic.get_interrupt_id();
|
|
|
|
if id.0 == 0 {
|
|
|
|
gic.end_interrupt(id);
|
|
|
|
asm::exit_irq();
|
|
|
|
SP.write(&mut __stack1_start as *mut _ as u32);
|
|
|
|
asm::enable_irq();
|
|
|
|
main_core1();
|
|
|
|
}
|
|
|
|
}
|
2020-07-06 21:02:46 +08:00
|
|
|
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 {}
|
|
|
|
}
|