Lines Matching defs:exception

588 		 * In order to reflect the #DB exception payload in guest
656 * If the exception is destined for L2 and isn't being reinjected,
657 * morph it to a VM-Exit if L1 wants to intercept the exception. A
658 * previously injected exception is not checked because it was checked
660 * injected the exception, in which case it's exempt from interception.
669 if (!vcpu->arch.exception.pending && !vcpu->arch.exception.injected) {
673 * On VM-Entry, an exception can be pending if and only
680 vcpu->arch.exception.injected = true;
690 vcpu->arch.exception.pending = true;
691 vcpu->arch.exception.injected = false;
693 vcpu->arch.exception.has_error_code = has_error;
694 vcpu->arch.exception.vector = nr;
695 vcpu->arch.exception.error_code = error_code;
696 vcpu->arch.exception.has_payload = has_payload;
697 vcpu->arch.exception.payload = payload;
700 &vcpu->arch.exception);
704 /* to check exception */
705 prev_nr = vcpu->arch.exception.vector;
717 * exception so as not to incorrectly trigger shutdown.
719 vcpu->arch.exception.injected = false;
720 vcpu->arch.exception.pending = false;
724 /* replace previous exception with a new one in a hope
726 exception */
4973 * Do not cause an interrupt window exit if an exception
5160 * KVM's ABI only allows for one exception to be migrated. Luckily,
5162 * non-exiting _injected_ exception, and a pending exiting exception.
5163 * In that case, ignore the VM-Exiting exception as it's an extension
5164 * of the injected exception.
5167 !vcpu->arch.exception.pending &&
5168 !vcpu->arch.exception.injected)
5171 ex = &vcpu->arch.exception;
5174 * In guest mode, payload delivery should be deferred if the exception
5190 * isn't advanced, we should expect to encounter the exception
5194 events->exception.injected = ex->injected;
5195 events->exception.pending = ex->pending;
5202 events->exception.injected |= ex->pending;
5204 events->exception.nr = ex->vector;
5205 events->exception.has_error_code = ex->has_error_code;
5206 events->exception.error_code = ex->error_code;
5254 if (events->exception.pending)
5255 events->exception.injected = 0;
5259 events->exception.pending = 0;
5263 if ((events->exception.injected || events->exception.pending) &&
5264 (events->exception.nr > 31 || events->exception.nr == NMI_VECTOR))
5276 * Flag that userspace is stuffing an exception, the next KVM_RUN will
5277 * morph the exception to a VM-Exit if appropriate. Do this only for
5280 * is hosed, and will incorrectly convert an injected exception into a
5281 * pending exception, which in turn may cause a spurious VM-Exit.
5283 vcpu->arch.exception_from_userspace = events->exception.pending;
5287 vcpu->arch.exception.injected = events->exception.injected;
5288 vcpu->arch.exception.pending = events->exception.pending;
5289 vcpu->arch.exception.vector = events->exception.nr;
5290 vcpu->arch.exception.has_error_code = events->exception.has_error_code;
5291 vcpu->arch.exception.error_code = events->exception.error_code;
5292 vcpu->arch.exception.has_payload = events->exception_has_payload;
5293 vcpu->arch.exception.payload = events->exception_payload;
7301 struct x86_exception *exception)
7310 t_gpa = mmu->gva_to_gpa(vcpu, mmu, gpa, access, exception);
7316 struct x86_exception *exception)
7321 return mmu->gva_to_gpa(vcpu, mmu, gva, access, exception);
7326 struct x86_exception *exception)
7332 return mmu->gva_to_gpa(vcpu, mmu, gva, access, exception);
7338 struct x86_exception *exception)
7342 return mmu->gva_to_gpa(vcpu, mmu, gva, 0, exception);
7347 struct x86_exception *exception)
7354 gpa_t gpa = mmu->gva_to_gpa(vcpu, mmu, addr, access, exception);
7379 struct x86_exception *exception)
7389 exception);
7406 struct x86_exception *exception)
7416 memset(exception, 0, sizeof(*exception));
7418 exception);
7424 struct x86_exception *exception, bool system)
7434 return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, exception);
7439 struct x86_exception *exception)
7446 gpa_t gpa = mmu->gva_to_gpa(vcpu, mmu, addr, access, exception);
7468 unsigned int bytes, struct x86_exception *exception,
7480 access, exception);
7484 unsigned int bytes, struct x86_exception *exception)
7490 PFERR_WRITE_MASK, exception);
7542 gpa_t *gpa, struct x86_exception *exception,
7563 *gpa = mmu->gva_to_gpa(vcpu, mmu, gva, access, exception);
7657 struct x86_exception *exception,
7679 ret = vcpu_mmio_gva_to_gpa(vcpu, addr, &gpa, exception, write);
7709 struct x86_exception *exception,
7727 rc = emulator_read_write_onepage(addr, val, now, exception,
7739 rc = emulator_read_write_onepage(addr, val, bytes, exception,
7764 struct x86_exception *exception)
7767 exception, &read_emultor);
7774 struct x86_exception *exception)
7777 exception, &write_emultor);
7788 struct x86_exception *exception)
7853 return emulator_write_emulated(ctxt, addr, new, bytes, exception);
8252 &ctxt->exception);
8397 if (ctxt->exception.vector == PF_VECTOR)
8398 kvm_inject_emulated_page_fault(vcpu, &ctxt->exception);
8399 else if (ctxt->exception.error_code_valid)
8400 kvm_queue_exception_e(vcpu, ctxt->exception.vector,
8401 ctxt->exception.error_code);
8403 kvm_queue_exception(vcpu, ctxt->exception.vector);
8442 ctxt->exception.vector = -1;
8718 kvm_run->debug.arch.exception = DB_VECTOR;
8742 * processor will not generate this exception after the instruction
8776 * the instruction has passed all exception checks, and all intercepted
8778 * breakpoints, i.e. the fact that the intercepted exception occurred
8784 * to behave as if KVM intercepted the instruction without an exception
8802 kvm_run->debug.arch.exception = DB_VECTOR;
8860 * (and wrong) when emulating on an intercepted fault-like exception[*], as
8923 * exception should not be encountered during decode.
8925 WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR ||
8926 exception_type(ctxt->exception.vector) == EXCPT_TRAP);
8976 ctxt->exception.address = cr2_or_gpa;
8985 ctxt->exception.address = 0;
9041 exception_type(ctxt->exception.vector) == EXCPT_TRAP) {
9484 * with an exception. PAT[0] is set to WB on RESET and also by the
9939 ctxt->exception.error_code_valid = false;
9940 ctxt->exception.vector = UD_VECTOR;
9948 &ctxt->exception);
10016 * is carried with the exception and only stripped when the exception
10020 vcpu->arch.exception.has_error_code &= is_protmode(vcpu);
10022 trace_kvm_inj_exception(vcpu->arch.exception.vector,
10023 vcpu->arch.exception.has_error_code,
10024 vcpu->arch.exception.error_code,
10025 vcpu->arch.exception.injected);
10031 * Check for any event (interrupt or exception) that is ready to be injected,
10049 * the instruction or injecting an exception, e.g. instruction and exception
10054 * the instruction or inject an exception, then KVM can incorrecty inject a new
10090 * Don't re-inject an NMI or interrupt if there is a pending exception.
10091 * This collision arises if an exception occurred while vectoring the
10092 * injected event, KVM intercepted said exception, and KVM ultimately
10093 * determined the fault belongs to the guest and queues the exception
10098 * an interrupt. In that case, prioritizing the exception is correct,
10099 * as the exception "occurred" before the exit to userspace. Trap-like
10104 * Thus a pending fault-like exception means the fault occurred on the
10108 if (vcpu->arch.exception.injected)
10120 * either morph to #DF or, sadly, override the injected exception.
10122 WARN_ON_ONCE(vcpu->arch.exception.injected &&
10123 vcpu->arch.exception.pending);
10138 * A pending exception VM-Exit should either result in nested VM-Exit
10139 * or force an immediate re-entry and exit to/from L2, and exception
10152 if (vcpu->arch.exception.pending) {
10155 * value pushed on the stack. Trap-like exception and all #DBs
10163 if (exception_type(vcpu->arch.exception.vector) == EXCPT_FAULT)
10167 if (vcpu->arch.exception.vector == DB_VECTOR) {
10168 kvm_deliver_exception_payload(vcpu, &vcpu->arch.exception);
10177 vcpu->arch.exception.pending = false;
10178 vcpu->arch.exception.injected = true;
10251 * KVM must never queue a new exception while injecting an event; KVM
10253 * to the VMCS/VMCB. Queueing a new exception can put the vCPU into an
10255 * exception and start the cycle all over.
10262 WARN_ON_ONCE(vcpu->arch.exception.pending ||
11110 struct kvm_queued_exception *ex = &vcpu->arch.exception;
11174 * If userspace set a pending exception and L2 is active, convert it to
11175 * a pending VM-Exit if L1 wants to intercept the exception.
11293 vcpu->arch.exception.pending = false;
13097 * exception setup.