Date: Tue, 30 Dec 2014 02:44:34 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276392 - head/sys/amd64/vmm/amd Message-ID: <201412300244.sBU2iYY7015232@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Tue Dec 30 02:44:33 2014 New Revision: 276392 URL: https://svnweb.freebsd.org/changeset/base/276392 Log: Inject #UD into the guest when it executes either 'MONITOR' or 'MWAIT' on an AMD/SVM host. MFC after: 1 week Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/amd/vmcb.h Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Tue Dec 30 02:39:47 2014 (r276391) +++ head/sys/amd64/vmm/amd/svm.c Tue Dec 30 02:44:33 2014 (r276392) @@ -461,6 +461,9 @@ vmcb_init(struct svm_softc *sc, int vcpu svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_FERR_FREEZE); + svm_enable_intercept(sc, vcpu, VMCB_CTRL2_INTCPT, VMCB_INTCPT_MONITOR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL2_INTCPT, VMCB_INTCPT_MWAIT); + /* * From section "Canonicalization and Consistency Checks" in APMv2 * the VMRUN intercept bit must be set to pass the consistency check. @@ -1140,6 +1143,10 @@ exit_reason_to_str(uint64_t reason) return ("msr"); case VMCB_EXIT_IRET: return ("iret"); + case VMCB_EXIT_MONITOR: + return ("monitor"); + case VMCB_EXIT_MWAIT: + return ("mwait"); default: snprintf(reasonbuf, sizeof(reasonbuf), "%#lx", reason); return (reasonbuf); @@ -1406,6 +1413,12 @@ svm_vmexit(struct svm_softc *svm_sc, int info2, info1, state->rip); } break; + case VMCB_EXIT_MONITOR: + vmexit->exitcode = VM_EXITCODE_MONITOR; + break; + case VMCB_EXIT_MWAIT: + vmexit->exitcode = VM_EXITCODE_MWAIT; + break; default: vmm_stat_incr(svm_sc->vm, vcpu, VMEXIT_UNKNOWN, 1); break; Modified: head/sys/amd64/vmm/amd/vmcb.h ============================================================================== --- head/sys/amd64/vmm/amd/vmcb.h Tue Dec 30 02:39:47 2014 (r276391) +++ head/sys/amd64/vmm/amd/vmcb.h Tue Dec 30 02:44:33 2014 (r276392) @@ -140,6 +140,8 @@ struct svm_softc; #define VMCB_EXIT_MSR 0x7C #define VMCB_EXIT_SHUTDOWN 0x7F #define VMCB_EXIT_VMSAVE 0x83 +#define VMCB_EXIT_MONITOR 0x8A +#define VMCB_EXIT_MWAIT 0x8B #define VMCB_EXIT_NPF 0x400 #define VMCB_EXIT_INVALID -1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412300244.sBU2iYY7015232>