x86: show correct code in CPU state
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 3 May 2016 16:15:38 +0000 (17:15 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 3 May 2016 16:22:54 +0000 (17:22 +0100)
When showing the CPU state (e.g., after a crash) the dump of code
around RIP is incorrect.

Incorrect:

    Xen code around <ffff82d0801113cf> (...):
     00 c6 c1 ee 08 48 c1 e0 <04> 03 04 f1 8b ...
     ^^ Uninitialized         ^^ Missing 0x48

Correct:

    Xen code around <ffff82d0801113cf> (...):
     c6 c1 ee 08 48 c1 e0 04 <48> 03 04 f1 8b ...

When coping the bytes before RIP, the destination was off-by-one.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/traps.c

index 83841584553f28afe666f22fbb1f8deb56ab5466..08954412f877fabf441265a1394476c8cc0a742c 100644 (file)
@@ -150,7 +150,7 @@ static void show_code(const struct cpu_user_regs *regs)
                   : "=&c" (missing_before),
                     "=&D" (tmp), "=&S" (tmp)
                   : "0" (ARRAY_SIZE(insns_before)),
-                    "1" (insns_before + ARRAY_SIZE(insns_before)),
+                    "1" (insns_before + ARRAY_SIZE(insns_before) - 1),
                     "2" (regs->rip - 1));
     clac();