@@ -182,7 +182,7 @@ impl<H: AxVCpuHal> Aarch64VCpu<H> {
182182 ///
183183 /// When a VM-Exit happens when guest's vCpu is running,
184184 /// the control flow will be redirected to this function through `return_run_guest`.
185- #[ naked]
185+ #[ unsafe ( naked) ]
186186 unsafe extern "C" fn run_guest ( & mut self ) -> usize {
187187 // Fixes: https://github.com/arceos-hypervisor/arm_vcpu/issues/22
188188 //
@@ -191,25 +191,23 @@ impl<H: AxVCpuHal> Aarch64VCpu<H> {
191191 // original `run_guest` with the current naked one, we eliminate the dummy code path of the
192192 // original version, and ensure that the compiler does not perform any unexpected return
193193 // value optimization.
194- unsafe {
195- core:: arch:: naked_asm!(
196- // Save host context.
197- save_regs_to_stack!( ) ,
198- // Save current host stack top to `self.host_stack_top`.
199- //
200- // 'extern "C"' here specifies the aapcs64 calling convention, according to which
201- // the first and only parameter, the pointer of self, should be in x0:
202- "mov x9, sp" ,
203- "add x0, x0, {host_stack_top_offset}" ,
204- "str x9, [x0]" ,
205- // Go to `context_vm_entry`.
206- "b context_vm_entry" ,
207- // Panic if the control flow comes back here, which should never happen.
208- "b {run_guest_panic}" ,
209- host_stack_top_offset = const core:: mem:: size_of:: <TrapFrame >( ) ,
210- run_guest_panic = sym Self :: run_guest_panic,
211- ) ;
212- }
194+ core:: arch:: naked_asm!(
195+ // Save host context.
196+ save_regs_to_stack!( ) ,
197+ // Save current host stack top to `self.host_stack_top`.
198+ //
199+ // 'extern "C"' here specifies the aapcs64 calling convention, according to which
200+ // the first and only parameter, the pointer of self, should be in x0:
201+ "mov x9, sp" ,
202+ "add x0, x0, {host_stack_top_offset}" ,
203+ "str x9, [x0]" ,
204+ // Go to `context_vm_entry`.
205+ "b context_vm_entry" ,
206+ // Panic if the control flow comes back here, which should never happen.
207+ "b {run_guest_panic}" ,
208+ host_stack_top_offset = const core:: mem:: size_of:: <TrapFrame >( ) ,
209+ run_guest_panic = sym Self :: run_guest_panic,
210+ ) ;
213211 }
214212
215213 /// This function is called when the control flow comes back to `run_guest`. To provide a error
0 commit comments