ia64/xen-unstable

changeset 9558:920b448b5485

Minor minios traps.c fix for x86/64.

Signed-off-by: Aravindh Puthiyaparambil
<aravindh.puthiyaparambil@unisys.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Apr 01 10:39:31 2006 +0100 (2006-04-01)
parents 11228d42cff3
children aa13ac536dec
files extras/mini-os/traps.c
line diff
     1.1 --- a/extras/mini-os/traps.c	Sat Apr 01 10:37:36 2006 +0100
     1.2 +++ b/extras/mini-os/traps.c	Sat Apr 01 10:39:31 2006 +0100
     1.3 @@ -4,6 +4,7 @@
     1.4  #include <hypervisor.h>
     1.5  #include <mm.h>
     1.6  #include <lib.h>
     1.7 +#include <sched.h>
     1.8  
     1.9  /*
    1.10   * These are assembler stubs in entry.S.
    1.11 @@ -31,6 +32,8 @@ void machine_check(void);
    1.12  
    1.13  void dump_regs(struct pt_regs *regs)
    1.14  {
    1.15 +    printk("Thread: %s\n", current->name);
    1.16 +#ifdef __i386__    
    1.17      printk("EIP: %x, EFLAGS %x.\n", regs->eip, regs->eflags);
    1.18      printk("EBX: %08x ECX: %08x EDX: %08x\n",
    1.19  	   regs->ebx, regs->ecx, regs->edx);
    1.20 @@ -40,9 +43,22 @@ void dump_regs(struct pt_regs *regs)
    1.21  	   regs->xds, regs->xes, regs->orig_eax, regs->eip);
    1.22      printk("CS: %04x EFLAGS: %08x esp: %08x ss: %04x\n",
    1.23  	   regs->xcs, regs->eflags, regs->esp, regs->xss);
    1.24 -
    1.25 -}	
    1.26 -
    1.27 +#else
    1.28 +    printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
    1.29 +    printk("\nRSP: %04lx:%016lx  EFLAGS: %08lx\n", 
    1.30 +           regs->ss, regs->rsp, regs->eflags);
    1.31 +    printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
    1.32 +           regs->rax, regs->rbx, regs->rcx);
    1.33 +    printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
    1.34 +           regs->rdx, regs->rsi, regs->rdi); 
    1.35 +    printk("RBP: %016lx R08: %016lx R09: %016lx\n",
    1.36 +           regs->rbp, regs->r8, regs->r9); 
    1.37 +    printk("R10: %016lx R11: %016lx R12: %016lx\n",
    1.38 +           regs->r10, regs->r11, regs->r12); 
    1.39 +    printk("R13: %016lx R14: %016lx R15: %016lx\n",
    1.40 +           regs->r13, regs->r14, regs->r15); 
    1.41 +#endif
    1.42 +}
    1.43  
    1.44  static void do_trap(int trapnr, char *str, struct pt_regs * regs, unsigned long error_code)
    1.45  {
    1.46 @@ -110,36 +126,17 @@ void do_page_fault(struct pt_regs *regs,
    1.47      printk("Page fault at linear address %p, regs %p, code %lx\n", addr, regs,
    1.48  	   error_code);
    1.49      dump_regs(regs);
    1.50 -#ifdef __x86_64__
    1.51 -    /* FIXME: _PAGE_PSE */
    1.52 -    {
    1.53 -        unsigned long *tab = (unsigned long *)start_info.pt_base;
    1.54 -        unsigned long page;
    1.55 -    
    1.56 -        printk("Pagetable walk from %p:\n", tab);
    1.57 -        
    1.58 -        page = tab[l4_table_offset(addr)];
    1.59 -        tab = to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
    1.60 -        printk(" L4 = %p (%p)\n", page, tab);
    1.61 -
    1.62 -        page = tab[l3_table_offset(addr)];
    1.63 -        tab = to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
    1.64 -        printk("  L3 = %p (%p)\n", page, tab);
    1.65 -        
    1.66 -        page = tab[l2_table_offset(addr)];
    1.67 -        tab =  to_virt(mfn_to_pfn(pte_to_mfn(page)) << PAGE_SHIFT);
    1.68 -        printk("   L2 = %p (%p)\n", page, tab);
    1.69 -        
    1.70 -        page = tab[l1_table_offset(addr)];
    1.71 -        printk("    L1 = %p\n", page);
    1.72 -    }
    1.73 -#endif
    1.74 +    page_walk(addr);
    1.75      do_exit();
    1.76  }
    1.77  
    1.78  void do_general_protection(struct pt_regs *regs, long error_code)
    1.79  {
    1.80 -    printk("GPF %p, error_code=%lx\n", regs, error_code);
    1.81 +#ifdef __i386__
    1.82 +    printk("GPF eip: %p, error_code=%lx\n", regs->eip, error_code);
    1.83 +#else    
    1.84 +    printk("GPF rip: %p, error_code=%lx\n", regs->rip, error_code);
    1.85 +#endif
    1.86      dump_regs(regs);
    1.87      do_exit();
    1.88  }