diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile --- a/usr.sbin/bhyvectl/Makefile +++ b/usr.sbin/bhyvectl/Makefile @@ -12,8 +12,6 @@ LIBADD= vmmapi util -WARNS?= 3 - CFLAGS+= -I${SRCTOP}/sys/amd64/vmm .if ${MK_BHYVE_SNAPSHOT} != "no" diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -294,7 +294,7 @@ static int set_cs, set_ds, set_es, set_fs, set_gs, set_ss, set_tr, set_ldtr; static int get_cs, get_ds, get_es, get_fs, get_gs, get_ss, get_tr, get_ldtr; static int set_x2apic_state, get_x2apic_state; -enum x2apic_state x2apic_state; +static enum x2apic_state x2apic_state; static int unassign_pptdev, bus, slot, func; static int run; static int get_cpu_topology; @@ -316,7 +316,6 @@ static int get_eptp, get_io_bitmap, get_tsc_offset; static int get_vmcs_entry_interruption_info; static int get_vmcs_interruptibility; -uint32_t vmcs_entry_interruption_info; static int get_vmcs_gpa, get_vmcs_gla; static int get_exception_bitmap; static int get_cr0_mask, get_cr0_shadow; @@ -497,8 +496,8 @@ static int dump_msr_bitmap(int vcpu, uint64_t addr, bool cpu_intel) { + char *bitmap; int error, fd, map_size; - const char *bitmap; error = -1; bitmap = MAP_FAILED; @@ -648,25 +647,20 @@ static bool cpu_vendor_intel(void) { - u_int regs[4]; - char cpu_vendor[13]; + u_int regs[4], v[3]; do_cpuid(0, regs); - ((u_int *)&cpu_vendor)[0] = regs[1]; - ((u_int *)&cpu_vendor)[1] = regs[3]; - ((u_int *)&cpu_vendor)[2] = regs[2]; - cpu_vendor[12] = '\0'; + v[0] = regs[1]; + v[1] = regs[3]; + v[2] = regs[2]; - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) { - return (false); - } else if (strcmp(cpu_vendor, "HygonGenuine") == 0) { - return (false); - } else if (strcmp(cpu_vendor, "GenuineIntel") == 0) { + if (memcmp(v, "GenuineIntel", sizeof(v)) == 0) return (true); - } else { - fprintf(stderr, "Unknown cpu vendor \"%s\"\n", cpu_vendor); - exit(1); - } + if (memcmp(v, "AuthenticAMD", sizeof(v)) == 0 || + memcmp(v, "HygonGenuine", sizeof(v)) == 0) + return (false); + fprintf(stderr, "Unknown cpu vendor \"%s\"\n", (const char *)v); + exit(1); } static int