diff mbox series

VMX: no open-coding in vmx_get_cpl()

Message ID 1d787e05-28cb-4d1a-9ea6-696d5005f37b@suse.com (mailing list archive)
State New, archived
Headers show
Series VMX: no open-coding in vmx_get_cpl() | expand

Commit Message

Jan Beulich April 25, 2024, 1:27 p.m. UTC
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).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper April 25, 2024, 1:31 p.m. UTC | #1
On 25/04/2024 2:27 pm, Jan Beulich wrote:
> 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).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooepr <andrew.cooper3@citrix.com>
diff mbox series

Patch

--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -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)