x86/emul: Replace opencoded extraction of IOPL from eflags
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 6 Jan 2017 20:03:08 +0000 (20:03 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Jan 2017 17:25:09 +0000 (17:25 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 98ba7c53b8756514e04fa689e69e4085f05785a4..c4ba79b0cd7d0f4ab2ad76d68fe88bc472885ed6 100644 (file)
@@ -1157,7 +1157,7 @@ _mode_iopl(
     int cpl = get_cpl(ctxt, ops);
     if ( cpl == -1 )
         return -1;
-    return (cpl <= ((ctxt->regs->_eflags >> 12) & 3));
+    return cpl <= MASK_EXTR(ctxt->regs->_eflags, EFLG_IOPL);
 }
 
 #define mode_ring0() ({                         \