1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-30 00:00:15 +01:00

enable MSR for string operations already in uhyve

This commit is contained in:
Stefan Lankes 2017-11-06 21:38:33 +01:00
parent ed75d01517
commit 794f4ac3d3
2 changed files with 12 additions and 4 deletions

View file

@ -637,10 +637,6 @@ int cpu_detection(void) {
if (first_time) {
// enable fast string operations
uint64_t misc = rdmsr(MSR_IA32_MISC_ENABLE);
wrmsr(MSR_IA32_MISC_ENABLE, misc | MSR_IA32_MISC_ENABLE_FAST_STRING);
LOG_INFO("CR0 0x%llx, CR4 0x%llx\n", read_cr0(), read_cr4());
LOG_INFO("size of xsave_t: %d\n", sizeof(xsave_t));
if (has_msr()) {

View file

@ -1069,9 +1069,21 @@ static int vcpu_init(void)
kvm_ioctl(vcpufd, KVM_SET_XSAVE, &xsave);
kvm_ioctl(vcpufd, KVM_SET_VCPU_EVENTS, &events);
} else {
struct {
struct kvm_msrs info;
struct kvm_msr_entry entries[MAX_MSR_ENTRIES];
} msr_data;
struct kvm_msr_entry *msrs = msr_data.entries;
// be sure that the multiprocessor is runable
kvm_ioctl(vcpufd, KVM_SET_MP_STATE, &mp_state);
// enable fast string operations
msrs[0].index = MSR_IA32_MISC_ENABLE;
msrs[0].data = 1;
msr_data.info.nmsrs = 1;
kvm_ioctl(vcpufd, KVM_SET_MSRS, &msr_data);
/* Setup registers and memory. */
setup_system(vcpufd, guest_mem, cpuid);
kvm_ioctl(vcpufd, KVM_SET_REGS, &regs);