Correctly handle dumping a VM86 guest's stack.
authorIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Fri, 13 Jan 2006 16:56:09 +0000 (16:56 +0000)
committerIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Fri, 13 Jan 2006 16:56:09 +0000 (16:56 +0000)
If the guest context is VM86 then we need to treat ss:sp as 16 bit
segment:offset rather than 32 bit selector:offset.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
xen/arch/x86/traps.c

index 93b11e36c1b2116251af4e355b9fccaa3ca47d94..0a7280fb70c0b4aa09fd8a4191d8ec704dc31732 100644 (file)
@@ -130,9 +130,19 @@ unsigned long kernel_text_end(void)
 static void show_guest_stack(struct cpu_user_regs *regs)
 {
     int i;
-    unsigned long *stack = (unsigned long *)regs->esp, addr;
+    unsigned long *stack, addr;
 
-    printk("Guest stack trace from "__OP"sp=%p:\n   ", stack);
+    if ( VM86_MODE(regs) )
+    {
+        stack = (unsigned long *)((regs->ss << 4) + (regs->esp & 0xffff));
+        printk("Guest stack trace from ss:sp = %04x:%04x (VM86)\n   ",
+               regs->ss, (uint16_t)(regs->esp & 0xffff));
+    }
+    else
+    {
+        stack = (unsigned long *)regs->esp;
+        printk("Guest stack trace from "__OP"sp=%p:\n   ", stack);
+    }
 
     for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
     {