Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Commit 6f693d4

Browse files
committed
Using designated initializers
1 parent e74a4ec commit 6f693d4

4 files changed

Lines changed: 30 additions & 38 deletions

File tree

core/hax.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141

4242
/* deal with module parameter */
4343
struct config_t config = {
44-
0, /* memory_pass_through */
45-
0, /* disable_ept */
46-
1, /* ept_small_pages */
47-
1, /* disable_vpid */
48-
1, /* disable_unrestricted_guest */
49-
1, /* no_cpuid_pass_through */
50-
0, /* cpuid_pass_through */
51-
0, /* cpuid_no_mwait */
52-
0
53-
}; /* no_msr_pass_through */
44+
.memory_pass_through = 0,
45+
.disable_ept = 0,
46+
.ept_small_pages = 1,
47+
.disable_vpid = 1,
48+
.disable_unrestricted_guest = 1,
49+
.no_cpuid_pass_through = 1,
50+
.cpuid_pass_through = 0,
51+
.cpuid_no_mwait = 0,
52+
.no_msr_pass_through = 0
53+
};
5454

5555
struct hax_page *io_bitmap_page_a;
5656
struct hax_page *io_bitmap_page_b;
@@ -147,7 +147,7 @@ int hax_em64t_enabled(void)
147147
*/
148148
static int hax_vmx_enable_check(void)
149149
{
150-
int vts = 0, nxs =0, vte = 0, nxe = 0, em64s = 0, em64e = 0, finished = 0;
150+
int vts = 0, nxs = 0, vte = 0, nxe = 0, em64s = 0, em64e = 0, finished = 0;
151151
int cpu, tnum = 0, error = 0;
152152

153153
for (cpu = 0; cpu < max_cpus; cpu++) {

core/vcpu.c

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -367,31 +367,23 @@ static int vcpu_vpid_free(struct vcpu_t *vcpu)
367367
}
368368

369369
static int (*handler_funcs[])(struct vcpu_t *vcpu, struct hax_tunnel *htun) = {
370-
exit_exc_nmi,
371-
exit_interrupt,
372-
exit_triple_fault,
373-
0, 0, 0, 0,
374-
exit_interrupt_window, // Interrupt window
375-
exit_interrupt_window, // NMI window
376-
0,
377-
exit_cpuid,
378-
0,
379-
exit_hlt,
380-
0,
381-
exit_invlpg,
382-
0,
383-
exit_rdtsc,
384-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 17 ... 27
385-
exit_cr_access,
386-
exit_dr_access,
387-
exit_io_access,
388-
exit_msr_read,
389-
exit_msr_write,
390-
exit_invalid_guest_state,
391-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 34 ... 47
392-
exit_ept_violation,
393-
exit_ept_misconfiguration,
394-
0, 0, 0, 0, 0, 0 // 50 ... 55
370+
[VMX_EXIT_INT_EXCEPTION_NMI] = exit_exc_nmi,
371+
[VMX_EXIT_EXT_INTERRUPT] = exit_interrupt,
372+
[VMX_EXIT_TRIPLE_FAULT] = exit_triple_fault,
373+
[VMX_EXIT_PENDING_INTERRUPT] = exit_interrupt_window,
374+
[VMX_EXIT_PENDING_NMI] = exit_interrupt_window,
375+
[VMX_EXIT_CPUID] = exit_cpuid,
376+
[VMX_EXIT_HLT] = exit_hlt,
377+
[VMX_EXIT_INVLPG] = exit_invlpg,
378+
[VMX_EXIT_RDTSC] = exit_rdtsc,
379+
[VMX_EXIT_CR_ACCESS] = exit_cr_access,
380+
[VMX_EXIT_DR_ACCESS] = exit_dr_access,
381+
[VMX_EXIT_IO] = exit_io_access,
382+
[VMX_EXIT_MSR_READ] = exit_msr_read,
383+
[VMX_EXIT_MSR_WRITE] = exit_msr_write,
384+
[VMX_EXIT_FAILED_VMENTER_GS] = exit_invalid_guest_state,
385+
[VMX_EXIT_EPT_VIOLATION] = exit_ept_violation,
386+
[VMX_EXIT_EPT_MISCONFIG] = exit_ept_misconfiguration,
395387
};
396388

397389
static int nr_handlers = ARRAY_ELEMENTS(handler_funcs);

windows/hax_entry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int hax_host_init(void)
6060
/* we get the max_cpus from real_cpus in darwin, so add 1 here */
6161
max_cpus++;
6262

63-
ret =smpc_dpc_init();
63+
ret = smpc_dpc_init();
6464
if (ret < 0) {
6565
return ret;
6666
}

windows/hax_mm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ uint64_t get_hpfn_from_pmem(struct hax_vcpu_mem *pmem, uint64_t va)
195195
else
196196
return kphys.QuadPart >> page_shift;
197197
} else {
198-
unsigned long long index =0;
198+
unsigned long long index = 0;
199199
PMDL pmdl = NULL;
200200
PPFN_NUMBER ppfnnum;
201201

0 commit comments

Comments
 (0)