* Start vcpu with specified RIP. */
| 1985 | * Start vcpu with specified RIP. |
| 1986 | */ |
| 1987 | static int |
| 1988 | svm_run(void *arg, int vcpu, register_t rip, pmap_t pmap, |
| 1989 | struct vm_eventinfo *evinfo) |
| 1990 | { |
| 1991 | struct svm_regctx *gctx; |
| 1992 | struct svm_softc *svm_sc; |
| 1993 | struct svm_vcpu *vcpustate; |
| 1994 | struct vmcb_state *state; |
| 1995 | struct vmcb_ctrl *ctrl; |
| 1996 | struct vm_exit *vmexit; |
| 1997 | struct vlapic *vlapic; |
| 1998 | struct vm *vm; |
| 1999 | uint64_t vmcb_pa; |
| 2000 | int handled; |
| 2001 | uint16_t ldt_sel; |
| 2002 | |
| 2003 | svm_sc = arg; |
| 2004 | vm = svm_sc->vm; |
| 2005 | |
| 2006 | vcpustate = svm_get_vcpu(svm_sc, vcpu); |
| 2007 | state = svm_get_vmcb_state(svm_sc, vcpu); |
| 2008 | ctrl = svm_get_vmcb_ctrl(svm_sc, vcpu); |
| 2009 | vmexit = vm_exitinfo(vm, vcpu); |
| 2010 | vlapic = vm_lapic(vm, vcpu); |
| 2011 | |
| 2012 | gctx = svm_get_guest_regctx(svm_sc, vcpu); |
| 2013 | vmcb_pa = svm_sc->vcpu[vcpu].vmcb_pa; |
| 2014 | |
| 2015 | if (vcpustate->lastcpu != curcpu) { |
| 2016 | /* |
| 2017 | * Force new ASID allocation by invalidating the generation. |
| 2018 | */ |
| 2019 | vcpustate->asid.gen = 0; |
| 2020 | |
| 2021 | /* |
| 2022 | * Invalidate the VMCB state cache by marking all fields dirty. |
| 2023 | */ |
| 2024 | svm_set_dirty(svm_sc, vcpu, 0xffffffff); |
| 2025 | |
| 2026 | /* |
| 2027 | * XXX |
| 2028 | * Setting 'vcpustate->lastcpu' here is bit premature because |
| 2029 | * we may return from this function without actually executing |
| 2030 | * the VMRUN instruction. This could happen if a rendezvous |
| 2031 | * or an AST is pending on the first time through the loop. |
| 2032 | * |
| 2033 | * This works for now but any new side-effects of vcpu |
| 2034 | * migration should take this case into account. |
| 2035 | */ |
| 2036 | vcpustate->lastcpu = curcpu; |
| 2037 | vmm_stat_incr(vm, vcpu, VCPU_MIGRATIONS, 1); |
| 2038 | } |
| 2039 | |
| 2040 | svm_msr_guest_enter(svm_sc, vcpu); |
| 2041 | |
| 2042 | /* Update Guest RIP */ |
| 2043 | state->rip = rip; |
| 2044 |
nothing calls this directly
no test coverage detected