Quellcode-Bibliothek cr4_cpuid_sync_test.c
Sprache: C
// SPDX-License-Identifier: GPL-2.0 /* * CR4 and CPUID sync test * * Copyright 2018, Red Hat, Inc. and/or its affiliates. * * Author: * Wei Huang <wei@redhat.com>
*/
/* * Notify hypervisor to clear CR4.0SXSAVE, do CPUID and save output, * and then restore CR4. Do this all in assembly to ensure no AVX * instructions are executed while OSXSAVE=0.
*/ asmvolatile ( "out %%al, $" __stringify(MAGIC_HYPERCALL_PORT) "\n\t" "cpuid\n\t" "mov %%rdi, %%cr4\n\t"
: "+a" (regs[KVM_CPUID_EAX]), "=b" (regs[KVM_CPUID_EBX]), "+c" (regs[KVM_CPUID_ECX]), "=d" (regs[KVM_CPUID_EDX])
: "D" (get_cr4())
);
/* Verify KVM cleared OSXSAVE in CPUID when it was cleared in CR4. */
GUEST_ASSERT(!(regs[X86_FEATURE_OSXSAVE.reg] & BIT(X86_FEATURE_OSXSAVE.bit)));
/* Verify restoring CR4 also restored OSXSAVE in CPUID. */
GUEST_ASSERT(this_cpu_has(X86_FEATURE_OSXSAVE));
switch (get_ucall(vcpu, &uc)) { case UCALL_ABORT:
REPORT_GUEST_ASSERT(uc); break; case UCALL_DONE: goto done; default:
TEST_FAIL("Unknown ucall %lu", uc.cmd);
}
}
done:
kvm_vm_free(vm); return 0;
}
Messung V0.5
¤ 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.0.13Bemerkung:
(vorverarbeitet)
¤
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.