1 // Copyright 2022, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 //! Exception handlers.
16
17 use vmbase::{arch::aarch64::exceptions::ArmException, read_sysreg};
18
19 #[no_mangle]
sync_exception_current(elr: u64, _spsr: u64)20 extern "C" fn sync_exception_current(elr: u64, _spsr: u64) {
21 ArmException::from_el1_regs().print_and_reboot(
22 "sync_exception_current",
23 "Unexpected synchronous exception",
24 elr,
25 );
26 }
27
28 #[no_mangle]
irq_current(_elr: u64, _spsr: u64)29 extern "C" fn irq_current(_elr: u64, _spsr: u64) {
30 panic!("irq_current");
31 }
32
33 #[no_mangle]
fiq_current(_elr: u64, _spsr: u64)34 extern "C" fn fiq_current(_elr: u64, _spsr: u64) {
35 panic!("fiq_current");
36 }
37
38 #[no_mangle]
serr_current(_elr: u64, _spsr: u64)39 extern "C" fn serr_current(_elr: u64, _spsr: u64) {
40 let esr = read_sysreg!("esr_el1");
41 panic!("serr_current, esr={:#08x}", esr);
42 }
43
44 #[no_mangle]
sync_lower(_elr: u64, _spsr: u64)45 extern "C" fn sync_lower(_elr: u64, _spsr: u64) {
46 let esr = read_sysreg!("esr_el1");
47 panic!("sync_lower, esr={:#08x}", esr);
48 }
49
50 #[no_mangle]
irq_lower(_elr: u64, _spsr: u64)51 extern "C" fn irq_lower(_elr: u64, _spsr: u64) {
52 panic!("irq_lower");
53 }
54
55 #[no_mangle]
fiq_lower(_elr: u64, _spsr: u64)56 extern "C" fn fiq_lower(_elr: u64, _spsr: u64) {
57 panic!("fiq_lower");
58 }
59
60 #[no_mangle]
serr_lower(_elr: u64, _spsr: u64)61 extern "C" fn serr_lower(_elr: u64, _spsr: u64) {
62 let esr = read_sysreg!("esr_el1");
63 panic!("serr_lower, esr={:#08x}", esr);
64 }
65