1- use crate :: { TrapFrame , handle_irq} ;
21use 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 } ;
1216use axvm_types:: {
1317 addr:: GuestPhysAddr ,
1418 device:: { AccessWidth , SysRegAddr } ,
1519} ;
16- use axerrno:: { AxError , AxResult } ;
17- use crate :: exit:: AxVCpuExitReason ;
1820
1921numeric_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