Skip to contentSkip to conversation

VMX: no open-coding in vmx_get_cpl()

PATCH In review Jan Beulich 2 participants 2 messages Apr 25, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VMX: no open-coding in vmx_get_cpl()

Neither X86_SEG_AR_DPL nor MASK_EXTR() should really be avoided here, using literal number instead.

No difference in generated code (with gcc13 at least).

xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -1192,7 +1192,7 @@ unsigned int vmx_get_cpl(void)
 
     __vmread(GUEST_SS_AR_BYTES, &attr);
 
-    return (attr >> 5) & 3;
+    return MASK_EXTR(attr, X86_SEG_AR_DPL);
 }
 
 static unsigned int cf_check _vmx_get_cpl(struct vcpu *v)