Index: sys/amd64/vmm/intel/vmx.c =================================================================== --- sys/amd64/vmm/intel/vmx.c +++ sys/amd64/vmm/intel/vmx.c @@ -1973,20 +1973,20 @@ return (fault_type); } -static boolean_t +static bool ept_emulation_fault(uint64_t ept_qual) { int read, write; /* EPT fault on an instruction fetch doesn't make sense here */ if (ept_qual & EPT_VIOLATION_INST_FETCH) - return (FALSE); + return (false); /* EPT fault must be a read fault or a write fault */ read = ept_qual & EPT_VIOLATION_DATA_READ ? 1 : 0; write = ept_qual & EPT_VIOLATION_DATA_WRITE ? 1 : 0; if ((read | write) == 0) - return (FALSE); + return (false); /* * The EPT violation must have been caused by accessing a @@ -1995,10 +1995,10 @@ */ if ((ept_qual & EPT_VIOLATION_GLA_VALID) == 0 || (ept_qual & EPT_VIOLATION_XLAT_VALID) == 0) { - return (FALSE); + return (false); } - return (TRUE); + return (true); } static __inline int Index: sys/amd64/vmm/intel/vmx_msr.c =================================================================== --- sys/amd64/vmm/intel/vmx_msr.c +++ sys/amd64/vmm/intel/vmx_msr.c @@ -45,24 +45,18 @@ #include "vmx.h" #include "vmx_msr.h" -static boolean_t +static bool vmx_ctl_allows_one_setting(uint64_t msr_val, int bitpos) { - if (msr_val & (1UL << (bitpos + 32))) - return (TRUE); - else - return (FALSE); + return ((msr_val & (1UL << (bitpos + 32))) != 0); } -static boolean_t +static bool vmx_ctl_allows_zero_setting(uint64_t msr_val, int bitpos) { - if ((msr_val & (1UL << bitpos)) == 0) - return (TRUE); - else - return (FALSE); + return ((msr_val & (1UL << bitpos)) == 0); } uint32_t @@ -89,16 +83,13 @@ { int i; uint64_t val, trueval; - boolean_t true_ctls_avail, one_allowed, zero_allowed; + bool true_ctls_avail, one_allowed, zero_allowed; /* We cannot ask the same bit to be set to both '1' and '0' */ if ((ones_mask ^ zeros_mask) != (ones_mask | zeros_mask)) return (EINVAL); - if (rdmsr(MSR_VMX_BASIC) & (1UL << 55)) - true_ctls_avail = TRUE; - else - true_ctls_avail = FALSE; + true_ctls_avail = (rdmsr(MSR_VMX_BASIC) & (1UL << 55)) != 0; val = rdmsr(ctl_reg); if (true_ctls_avail) Index: sys/amd64/vmm/io/ppt.h =================================================================== --- sys/amd64/vmm/io/ppt.h +++ sys/amd64/vmm/io/ppt.h @@ -39,7 +39,7 @@ int ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func, int idx, uint64_t addr, uint64_t msg, uint32_t vector_control); int ppt_assigned_devices(struct vm *vm); -boolean_t ppt_is_mmio(struct vm *vm, vm_paddr_t gpa); +bool ppt_is_mmio(struct vm *vm, vm_paddr_t gpa); /* * Returns the number of devices sequestered by the ppt driver for assignment Index: sys/amd64/vmm/io/ppt.c =================================================================== --- sys/amd64/vmm/io/ppt.c +++ sys/amd64/vmm/io/ppt.c @@ -339,7 +339,7 @@ return (num); } -boolean_t +bool ppt_is_mmio(struct vm *vm, vm_paddr_t gpa) { int i; @@ -355,11 +355,11 @@ if (seg->len == 0) continue; if (gpa >= seg->gpa && gpa < seg->gpa + seg->len) - return (TRUE); + return (true); } } - return (FALSE); + return (false); } static void Index: sys/amd64/vmm/vmm.c =================================================================== --- sys/amd64/vmm/vmm.c +++ sys/amd64/vmm/vmm.c @@ -847,7 +847,7 @@ } static void -vm_iommu_modify(struct vm *vm, boolean_t map) +vm_iommu_modify(struct vm *vm, bool map) { int i, sz; vm_paddr_t gpa, hpa; @@ -910,8 +910,8 @@ iommu_invalidate_tlb(vm->iommu); } -#define vm_iommu_unmap(vm) vm_iommu_modify((vm), FALSE) -#define vm_iommu_map(vm) vm_iommu_modify((vm), TRUE) +#define vm_iommu_unmap(vm) vm_iommu_modify((vm), false) +#define vm_iommu_map(vm) vm_iommu_modify((vm), true) int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func) @@ -1043,20 +1043,20 @@ return (0); } -static boolean_t +static bool is_descriptor_table(int reg) { switch (reg) { case VM_REG_GUEST_IDTR: case VM_REG_GUEST_GDTR: - return (TRUE); + return (true); default: - return (FALSE); + return (false); } } -static boolean_t +static bool is_segment_register(int reg) { @@ -1069,9 +1069,9 @@ case VM_REG_GUEST_GS: case VM_REG_GUEST_TR: case VM_REG_GUEST_LDTR: - return (TRUE); + return (true); default: - return (FALSE); + return (false); } } @@ -2233,7 +2233,7 @@ return (vm->vhpet); } -boolean_t +bool vmm_is_pptdev(int bus, int slot, int func) { int found, i, n; @@ -2252,7 +2252,7 @@ const char *names[] = { "pptdevs", "pptdevs2", "pptdevs3", NULL }; /* set pptdevs="1/2/3 4/5/6 7/8/9 10/11/12" */ - found = 0; + found = false; for (i = 0; names[i] != NULL && !found; i++) { cp = val = kern_getenv(names[i]); while (cp != NULL && *cp != '\0') { @@ -2261,7 +2261,7 @@ n = sscanf(cp, "%d/%d/%d", &b, &s, &f); if (n == 3 && bus == b && slot == s && func == f) { - found = 1; + found = true; break; } Index: sys/amd64/vmm/vmm_lapic.h =================================================================== --- sys/amd64/vmm/vmm_lapic.h +++ sys/amd64/vmm/vmm_lapic.h @@ -33,7 +33,7 @@ struct vm; -boolean_t lapic_msr(u_int num); +bool lapic_msr(u_int num); int lapic_rdmsr(struct vm *vm, int cpu, u_int msr, uint64_t *rval, bool *retu); int lapic_wrmsr(struct vm *vm, int cpu, u_int msr, uint64_t wval, Index: sys/amd64/vmm/vmm_lapic.c =================================================================== --- sys/amd64/vmm/vmm_lapic.c +++ sys/amd64/vmm/vmm_lapic.c @@ -137,13 +137,10 @@ return (0); } -static boolean_t +static bool x2apic_msr(u_int msr) { - if (msr >= 0x800 && msr <= 0xBFF) - return (TRUE); - else - return (FALSE); + return (msr >= 0x800 && msr <= 0xBFF); } static u_int @@ -153,14 +150,11 @@ return ((msr - 0x800) << 4); } -boolean_t +bool lapic_msr(u_int msr) { - if (x2apic_msr(msr) || (msr == MSR_APICBASE)) - return (TRUE); - else - return (FALSE); + return (x2apic_msr(msr) || (msr == MSR_APICBASE)); } int Index: sys/amd64/vmm/vmm_util.h =================================================================== --- sys/amd64/vmm/vmm_util.h +++ sys/amd64/vmm/vmm_util.h @@ -33,9 +33,9 @@ struct trapframe; -boolean_t vmm_is_intel(void); -boolean_t vmm_is_amd(void); -boolean_t vmm_supports_1G_pages(void); +bool vmm_is_intel(void); +bool vmm_is_amd(void); +bool vmm_supports_1G_pages(void); void dump_trapframe(struct trapframe *tf); Index: sys/amd64/vmm/vmm_util.c =================================================================== --- sys/amd64/vmm/vmm_util.c +++ sys/amd64/vmm/vmm_util.c @@ -38,26 +38,20 @@ #include "vmm_util.h" -boolean_t +bool vmm_is_intel(void) { - if (strcmp(cpu_vendor, "GenuineIntel") == 0) - return (TRUE); - else - return (FALSE); + return (strcmp(cpu_vendor, "GenuineIntel") == 0); } -boolean_t +bool vmm_is_amd(void) { - if (strcmp(cpu_vendor, "AuthenticAMD") == 0) - return (TRUE); - else - return (FALSE); + return (strcmp(cpu_vendor, "AuthenticAMD") == 0); } -boolean_t +bool vmm_supports_1G_pages(void) { unsigned int regs[4]; @@ -70,9 +64,9 @@ if (cpu_exthigh >= 0x80000001) { do_cpuid(0x80000001, regs); if (regs[3] & (1 << 26)) - return (TRUE); + return (true); } - return (FALSE); + return (false); } #include