Skip to content

Commit a6a16ef

Browse files
committed
fix: add logs
1 parent 601906f commit a6a16ef

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/exception.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::{TrapFrame, handle_irq};
21
use crate::exception_utils::{
32
exception_class, exception_class_value, exception_data_abort_access_is_write,
43
exception_data_abort_access_reg, exception_data_abort_access_reg_width,
@@ -7,14 +6,17 @@ use crate::exception_utils::{
76
exception_esr, exception_fault_addr, exception_next_instruction_step, exception_sysreg_addr,
87
exception_sysreg_direction_write, exception_sysreg_gpr,
98
};
9+
use crate::{TrapFrame, handle_irq};
1010

11-
use aarch64_cpu::registers::{ESR_EL2, HCR_EL2, Readable, SCTLR_EL1, VTCR_EL2, VTTBR_EL2};
11+
use crate::exit::AxVCpuExitReason;
12+
use aarch64_cpu::registers::{
13+
ESR_EL2, FAR_EL2, HCR_EL2, HPFAR_EL2, Readable, SCTLR_EL1, SPSR_EL2, VTCR_EL2, VTTBR_EL2,
14+
};
15+
use axerrno::{AxError, AxResult};
1216
use axvm_types::{
1317
addr::GuestPhysAddr,
1418
device::{AccessWidth, SysRegAddr},
1519
};
16-
use axerrno::{AxError, AxResult};
17-
use crate::exit::AxVCpuExitReason;
1820

1921
numeric_enum_macro::numeric_enum! {
2022
#[repr(u8)]
@@ -289,10 +291,16 @@ fn current_el_sync_handler(tf: &mut TrapFrame) {
289291
let esr = ESR_EL2.extract();
290292
let ec = ESR_EL2.read(ESR_EL2::EC);
291293
let iss = ESR_EL2.read(ESR_EL2::ISS);
294+
let far = FAR_EL2.get();
295+
let hpfar = HPFAR_EL2.get();
296+
let spsr_el2 = SPSR_EL2.get();
292297

293298
error!("ESR_EL2: {:#x}", esr.get());
294299
error!("Exception Class: {ec:#x}");
295300
error!("Instruction Specific Syndrome: {iss:#x}");
301+
error!("FAR_EL2: {far:#x}");
302+
error!("HPFAR_EL2: {hpfar:#x}");
303+
error!("SPSR_EL2: {spsr_el2:#x}");
296304

297305
panic!(
298306
"Unhandled synchronous exception from current EL: {:#x?}",
@@ -337,7 +345,7 @@ fn current_el_sync_handler(tf: &mut TrapFrame) {
337345
/// invoked as part of the low-level hypervisor or VM exit handling routines.
338346
#[unsafe(naked)]
339347
#[unsafe(no_mangle)]
340-
unsafe extern fn vmexit_trampoline() -> ! {
348+
unsafe extern "C" fn vmexit_trampoline() -> ! {
341349
core::arch::naked_asm!(
342350
// Curretly `sp` points to the base address of `Aarch64VCpu.ctx`, which stores guest's `TrapFrame`.
343351
"add x9, sp, 34 * 8", // Skip the exception frame.

0 commit comments

Comments
 (0)