/* * If both MWAIT and its quirk are disabled, MONITOR/MWAIT should #UD, in all * other scenarios KVM should emulate them as nops.
*/ #define GUEST_ASSERT_MONITOR_MWAIT(insn, testcase, vector) \ do { \ bool fault_wanted = ((testcase) & MWAIT_QUIRK_DISABLED) && \
((testcase) & MWAIT_DISABLED); \
\ if (fault_wanted) \
__GUEST_ASSERT((vector) == UD_VECTOR, \ "Expected #UD on " insn " for testcase '0x%x', got '0x%x'", \
testcase, vector); \ else \
__GUEST_ASSERT(!(vector), \ "Expected success on " insn " for testcase '0x%x', got '0x%x'", \
testcase, vector); \
} while (0)
u64 val = rdmsr(MSR_IA32_MISC_ENABLE) & ~MSR_IA32_MISC_ENABLE_MWAIT; if (!(testcase & MWAIT_DISABLED))
val |= MSR_IA32_MISC_ENABLE_MWAIT;
wrmsr(MSR_IA32_MISC_ENABLE, val);
/* * Arbitrarily MONITOR this function, SVM performs fault checks before * intercept checks, so the inputs for MONITOR and MWAIT must be valid.
*/
vector = kvm_asm_safe("monitor", "a"(guest_monitor_wait), "c"(0), "d"(0));
GUEST_ASSERT_MONITOR_MWAIT("MONITOR", testcase, vector);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.