pub fn run(&mut self) {
        let mut hvf_vcpu = HvfVcpu::new().expect("Can't create HVF vCPU");
        let hvf_vcpuid = hvf_vcpu.id();

        let (wfe_sender, wfe_receiver) = channel();
        self.intc
            .lock()
            .unwrap()
            .register_vcpu(hvf_vcpuid, wfe_sender);

        let entry_addr = if let Some(boot_receiver) = &self.boot_receiver {
            boot_receiver.recv().unwrap()
        } else {
            self.boot_entry_addr
        };

        hvf_vcpu
            .set_initial_state(entry_addr, self.fdt_addr)
            .unwrap_or_else(|_| panic!("Can't set HVF vCPU {} initial state", hvf_vcpuid));

        loop {
            match self.run_emulation(&mut hvf_vcpu) {
                // Emulation ran successfully, continue.
                Ok(VcpuEmulation::Handled) => (),
                // Emulation was interrupted by a breakpoint.
                Ok(VcpuEmulation::Interrupted) => self.wait_for_resume(),
                // Wait for an external event.
                Ok(VcpuEmulation::WaitForEvent) => {
                    self.wait_for_event(hvf_vcpuid, &wfe_receiver, None)
                }
                Ok(VcpuEmulation::WaitForEventExpired) => (),
                Ok(VcpuEmulation::WaitForEventTimeout(timeout)) => {
                    self.wait_for_event(hvf_vcpuid, &wfe_receiver, Some(timeout))
                }
                // The guest was rebooted or halted.
                Ok(VcpuEmulation::Stopped) => {
                    self.exit(FC_EXIT_CODE_OK);
                    break;
                }
                // Emulation errors lead to vCPU exit.
                Err(_) => {
                    self.exit(FC_EXIT_CODE_GENERIC_ERROR);
                    break;
                }
            }
        }
    }
/// Main loop of the vCPU thread.
Main loop of the vCPU thread.
Main loop of the vCPU thread .
pub fn run(&mut self) {
        let mut hvf_vcpu = HvfVcpu::new().expect("Can't create HVF vCPU");
        let hvf_vcpuid = hvf_vcpu.id();
        let (wfe_sender, wfe_receiver) = channel();
        self.intc
            .lock()
            .unwrap()
            .register_vcpu(hvf_vcpuid, wfe_sender);
        let entry_addr = if let Some(boot_receiver) = &self.boot_receiver {
            boot_receiver.recv().unwrap()
        } else {
            self.boot_entry_addr
        };
        hvf_vcpu
            .set_initial_state(entry_addr, self.fdt_addr)
            .unwrap_or_else(|_| panic!("Can't set HVF vCPU {} initial state", hvf_vcpuid));
        loop {
            match self.run_emulation(&mut hvf_vcpu) {
                // Emulation ran successfully, continue.
                Ok(VcpuEmulation::Handled) => (),
                // Emulation was interrupted by a breakpoint.
                Ok(VcpuEmulation::Interrupted) => self.wait_for_resume(),
                // Wait for an external event.
                Ok(VcpuEmulation::WaitForEvent) => {
                    self.wait_for_event(hvf_vcpuid, &wfe_receiver, None)
                }
                Ok(VcpuEmulation::WaitForEventExpired) => (),
                Ok(VcpuEmulation::WaitForEventTimeout(timeout)) => {
                    self.wait_for_event(hvf_vcpuid, &wfe_receiver, Some(timeout))
                }
                // The guest was rebooted or halted.
                Ok(VcpuEmulation::Stopped) => {
                    self.exit(FC_EXIT_CODE_OK);
                    break;
                }
                // Emulation errors lead to vCPU exit.
                Err(_) => {
                    self.exit(FC_EXIT_CODE_GENERIC_ERROR);
                    break;
                }
            }
        }
    }
pub fn run ( & mut self ) { let mut hvf_vcpu = HvfVcpu :: new ( ) . expect ( " " ) ; let hvf_vcpuid = hvf_vcpu . id ( ) ; let ( wfe_sender , wfe_receiver ) = channel ( ) ; self . intc . lock ( ) . unwrap ( ) . register_vcpu ( hvf_vcpuid , wfe_sender ) ; let entry_addr = if let Some ( boot_receiver ) = & self . boot_receiver { boot_receiver . recv ( ) . unwrap ( ) } else { self . boot_entry_addr } ; hvf_vcpu . set_initial_state ( entry_addr , self . fdt_addr ) . unwrap_or_else ( | _ | panic ! ( " " hvf_vcpuid ) ) ; loop { match self . run_emulation ( & mut hvf_vcpu ) { // Emulation ran successfully, continue. Ok ( VcpuEmulation :: Handled ) => ( ) , // Emulation was interrupted by a breakpoint. Ok ( VcpuEmulation :: Interrupted ) => self . wait_for_resume ( ) , // Wait for an external event. Ok ( VcpuEmulation :: WaitForEvent ) => { self . wait_for_event ( hvf_vcpuid , & wfe_receiver , None ) } Ok ( VcpuEmulation :: WaitForEventExpired ) => ( ) , Ok ( VcpuEmulation :: WaitForEventTimeout ( timeout ) ) => { self . wait_for_event ( hvf_vcpuid , & wfe_receiver , Some ( timeout ) ) } // The guest was rebooted or halted. Ok ( VcpuEmulation :: Stopped ) => { self . exit ( FC_EXIT_CODE_OK ) ; break ; } // Emulation errors lead to vCPU exit. Err ( _ ) => { self . exit ( FC_EXIT_CODE_GENERIC_ERROR ) ; break ; } } } }
Main loop of the vCPU thread.
Main loop of the vCPU thread .
&mut self