aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyvectl/bhyvectl.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bhyvectl/bhyvectl.c')
-rw-r--r--usr.sbin/bhyvectl/bhyvectl.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index 14ab6c7ad33e..cab1e6d72c56 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -294,7 +294,7 @@ static int set_desc_ldtr, get_desc_ldtr;
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_pinbased_ctls, get_procbased_ctls, get_procbased_ctls2;
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 @@ dump_intel_msr_pm(const char *bitmap, int vcpu)
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 @@ print_intinfo(const char *banner, uint64_t info)
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