Il 15/06/2014 16:24, Jan Kiszka ha scritto:
+       for (n = 0; n < ARRAY_SIZE(vmx_ctl_msr); n++) {
+               val = rdmsr(vmx_ctl_msr[n].index);
+               default1 = vmx_ctl_msr[n].default1;
+               ok = (val & default1) == default1 &&
+                       ((((u32)val) ^ (val >> 32)) & ~(val >> 32)) == 0;

Ouch, this can sure be make this more readable.

Please unify these:

union vmx_ctrl_pin {
        u64 val;
        struct {
                u32 set, clr;
        };
};

union vmx_ctrl_cpu {
        u64 val;
        struct {
                u32 set, clr;
        };
};

union vmx_ctrl_exit {
        u64 val;
        struct {
                u32 set, clr;
        };
};

union vmx_ctrl_ent {
        u64 val;
        struct {
                u32 set, clr;
        };
};


into a single "union vmx_ctl_msr", and use this union for val and true_val as well.

Paolo

+               if (ok && basic.ctrl) {
+                       true_val = rdmsr(vmx_ctl_msr[n].true_index);
+                       ok = (val >> 32) == (true_val >> 32) &&
+                               ((u32)(val ^ true_val) & ~default1) == 0;
+               }
+               report(vmx_ctl_msr[n].name, ok);


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to