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