x86/pv: Fix determination of 64bit mode in emulate_privilege_op()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 5 Jan 2017 11:23:15 +0000 (11:23 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 5 Jan 2017 12:22:55 +0000 (12:22 +0000)
ctxt->addr_size is expressed in bits rather than bytes, and has the value 16,
32 or 64.  Comparing < 8 made the intended non-64bit paths dead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/traps.c

index 2d211d1621bfb53680140245cfded96b817f1314..a33109d545a8056d932fb4311819ebd6b06ee278 100644 (file)
@@ -2100,7 +2100,7 @@ static int pv_emul_virt_to_linear(unsigned long base, unsigned long offset,
 
     *addr = base + offset;
 
-    if ( ctxt->addr_size < 8 )
+    if ( ctxt->addr_size < 64 )
     {
         if ( limit < bytes - 1 || offset > limit - bytes + 1 )
             rc = X86EMUL_EXCEPTION;
@@ -2169,7 +2169,7 @@ static int priv_op_read_segment(enum x86_segment seg,
                                 struct segment_register *reg,
                                 struct x86_emulate_ctxt *ctxt)
 {
-    if ( ctxt->addr_size < 8 )
+    if ( ctxt->addr_size < 64 )
     {
         unsigned long limit;
         unsigned int sel, ar;