MCPcopy Create free account
hub / github.com/F-Stack/f-stack / svm_eventinject

Function svm_eventinject

freebsd/amd64/vmm/amd/svm.c:930–967  ·  view source on GitHub ↗

* Inject an event to vcpu as described in section 15.20, "Event injection". */

Source from the content-addressed store, hash-verified

928 * Inject an event to vcpu as described in section 15.20, "Event injection".
929 */
930static void
931svm_eventinject(struct svm_softc *sc, int vcpu, int intr_type, int vector,
932 uint32_t error, bool ec_valid)
933{
934 struct vmcb_ctrl *ctrl;
935
936 ctrl = svm_get_vmcb_ctrl(sc, vcpu);
937
938 KASSERT((ctrl->eventinj & VMCB_EVENTINJ_VALID) == 0,
939 ("%s: event already pending %#lx", __func__, ctrl->eventinj));
940
941 KASSERT(vector >=0 && vector <= 255, ("%s: invalid vector %d",
942 __func__, vector));
943
944 switch (intr_type) {
945 case VMCB_EVENTINJ_TYPE_INTR:
946 case VMCB_EVENTINJ_TYPE_NMI:
947 case VMCB_EVENTINJ_TYPE_INTn:
948 break;
949 case VMCB_EVENTINJ_TYPE_EXCEPTION:
950 if (vector >= 0 && vector <= 31 && vector != 2)
951 break;
952 /* FALLTHROUGH */
953 default:
954 panic("%s: invalid intr_type/vector: %d/%d", __func__,
955 intr_type, vector);
956 }
957 ctrl->eventinj = vector | (intr_type << 8) | VMCB_EVENTINJ_VALID;
958 if (ec_valid) {
959 ctrl->eventinj |= VMCB_EVENTINJ_EC_VALID;
960 ctrl->eventinj |= (uint64_t)error << 32;
961 VCPU_CTR3(sc->vm, vcpu, "Injecting %s at vector %d errcode %#x",
962 intrtype_to_str(intr_type), vector, error);
963 } else {
964 VCPU_CTR2(sc->vm, vcpu, "Injecting %s at vector %d",
965 intrtype_to_str(intr_type), vector);
966 }
967}
968
969static void
970svm_update_virqinfo(struct svm_softc *sc, int vcpu)

Callers 2

svm_inj_intinfoFunction · 0.85
svm_inj_interruptsFunction · 0.85

Calls 3

svm_get_vmcb_ctrlFunction · 0.85
intrtype_to_strFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected