domain_crash_synchronous() on x86_64 causes Xen to crash because
it tries to dereference an invalid stack address. The patch below
fixes this. The patch also updates show_registers() to print the
same information as its x86_32 equivalent.
Signed-Off-By: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>
diff -r 3feb7fa331ed xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Sun Sep 11 16:44:23 2005
+++ b/xen/arch/x86/traps.c Sun Sep 11 19:48:23 2005
@@ -106,7 +106,7 @@
#define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)®s->esp)
#else
#define stack_words_per_line 4
-#define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)regs->esp)
+#define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)®s->rsp)
#endif
int is_kernel_text(unsigned long addr)
diff -r 3feb7fa331ed xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c Sun Sep 11 16:44:23 2005
+++ b/xen/arch/x86/x86_64/traps.c Sun Sep 11 19:48:23 2005
@@ -12,25 +12,61 @@
#include <asm/current.h>
#include <asm/flushtlb.h>
#include <asm/msr.h>
+#include <asm/vmx.h>
void show_registers(struct cpu_user_regs *regs)
{
- printk("CPU: %d\nRIP: %04x:[<%016lx>]",
- smp_processor_id(), 0xffff & regs->cs, regs->rip);
+ unsigned long rip, rsp, rflags, cs, cr0, cr3;
+ const char *context;
+
+ if ( VMX_DOMAIN(current) && regs->eflags == 0 )
+ {
+ __vmread(GUEST_RIP, &rip);
+ __vmread(GUEST_RSP, &rsp);
+ __vmread(GUEST_RFLAGS, &rflags);
+ __vmread(GUEST_CS_SELECTOR, &cs);
+ __vmread(CR0_READ_SHADOW, &cr0);
+ __vmread(GUEST_CR3, &cr3);
+ context = "vmx guest";
+ }
+ else
+ {
+ rip = regs->rip;
+ rflags = regs->rflags;
+ cr0 = read_cr0();
+ cr3 = read_cr3();
+
+ if ( GUEST_MODE(regs) )
+ {
+ rsp = regs->rsp;
+ cs = regs->cs & 0xffff;
+ context = "guest";
+ }
+ else
+ {
+ rsp = (unsigned long) ®s->rsp;
+ cs = __HYPERVISOR_CS;
+ context = "hypervisor";
+ }
+ }
+
+ printk("CPU: %d\nRIP: %04lx:[<%016lx>]",
+ smp_processor_id(), cs, rip);
if ( !GUEST_MODE(regs) )
- print_symbol(" %s", regs->rip);
- printk("\nRFLAGS: %016lx\n", regs->eflags);
+ print_symbol(" %s", rip);
+ printk("\nRFLAGS: %016lx CONTEXT: %s\n", rflags, context);
printk("rax: %016lx rbx: %016lx rcx: %016lx\n",
regs->rax, regs->rbx, regs->rcx);
printk("rdx: %016lx rsi: %016lx rdi: %016lx\n",
regs->rdx, regs->rsi, regs->rdi);
printk("rbp: %016lx rsp: %016lx r8: %016lx\n",
- regs->rbp, regs->rsp, regs->r8);
+ regs->rbp, rsp, regs->r8);
printk("r9: %016lx r10: %016lx r11: %016lx\n",
regs->r9, regs->r10, regs->r11);
printk("r12: %016lx r13: %016lx r14: %016lx\n",
regs->r12, regs->r13, regs->r14);
printk("r15: %016lx\n", regs->r15);
+ printk("cr0: %08lx cr3: %08lx\n", cr0, cr3);
show_stack(regs);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|