ia64/xen-unstable

changeset 5970:dcdcec634c2d

Better XenLinux page fault debug output for PAE.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Aug 02 16:11:31 2005 +0000 (2005-08-02)
parents 59e76450e286
children e173a853dc46 361d31028129
files linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Aug 02 15:42:06 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Aug 02 16:11:31 2005 +0000
     1.3 @@ -204,6 +204,63 @@ static inline int is_prefetch(struct pt_
     1.4  
     1.5  fastcall void do_invalid_op(struct pt_regs *, unsigned long);
     1.6  
     1.7 +#ifdef CONFIG_X86_PAE
     1.8 +static void dump_fault_path(unsigned long address)
     1.9 +{
    1.10 +	unsigned long *p, page;
    1.11 +
    1.12 +        page = __pa(per_cpu(cur_pgd, smp_processor_id()));
    1.13 +	p  = (unsigned long *)__va(page);
    1.14 +	p += (address >> 30) * 2;
    1.15 +	printk(KERN_ALERT "%08lx -> *pde = %08lx:%08lx\n", page, p[1], p[0]);
    1.16 +	if (p[0] & 1) {
    1.17 +		page = p[0] & PAGE_MASK;
    1.18 +		address &= 0x3fffffff;
    1.19 +		page = machine_to_phys(page);
    1.20 +		p  = (unsigned long *)__va(page);
    1.21 +		p += (address >> 21) * 2;
    1.22 +		printk(KERN_ALERT "%08lx -> *pme = %08lx:%08lx\n", page, p[1], p[0]);
    1.23 +#ifndef CONFIG_HIGHPTE
    1.24 +		if (p[0] & 1) {
    1.25 +			page = p[0] & PAGE_MASK;
    1.26 +			address &= 0x001fffff;
    1.27 +			page = machine_to_phys(page);
    1.28 +			p  = (unsigned long *) __va(page);
    1.29 +			p += (address >> 12) * 2;
    1.30 +			printk(KERN_ALERT "%08lx -> *pte = %08lx:%08lx\n", page, p[1], p[0]);
    1.31 +		}
    1.32 +#endif
    1.33 +	}
    1.34 +}
    1.35 +#else
    1.36 +static void dump_fault_path(unsigned long address)
    1.37 +{
    1.38 +	unsigned long page;
    1.39 +
    1.40 +	page = ((unsigned long *) per_cpu(cur_pgd, smp_processor_id()))
    1.41 +	    [address >> 22];
    1.42 +	printk(KERN_ALERT "*pde = ma %08lx pa %08lx\n", page,
    1.43 +	       machine_to_phys(page));
    1.44 +	/*
    1.45 +	 * We must not directly access the pte in the highpte
    1.46 +	 * case, the page table might be allocated in highmem.
    1.47 +	 * And lets rather not kmap-atomic the pte, just in case
    1.48 +	 * it's allocated already.
    1.49 +	 */
    1.50 +#ifndef CONFIG_HIGHPTE
    1.51 +	if (page & 1) {
    1.52 +		page &= PAGE_MASK;
    1.53 +		address &= 0x003ff000;
    1.54 +		page = machine_to_phys(page);
    1.55 +		page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT];
    1.56 +		printk(KERN_ALERT "*pte = ma %08lx pa %08lx\n", page,
    1.57 +		       machine_to_phys(page));
    1.58 +	}
    1.59 +#endif
    1.60 +}
    1.61 +#endif
    1.62 +
    1.63 +
    1.64  /*
    1.65   * This routine handles page faults.  It determines the address,
    1.66   * and the problem, and then passes it off to one of the appropriate
    1.67 @@ -220,7 +277,6 @@ fastcall void do_page_fault(struct pt_re
    1.68  	struct task_struct *tsk;
    1.69  	struct mm_struct *mm;
    1.70  	struct vm_area_struct * vma;
    1.71 -	unsigned long page;
    1.72  	int write;
    1.73  	siginfo_t info;
    1.74  
    1.75 @@ -454,26 +510,7 @@ no_context:
    1.76  	printk(" at virtual address %08lx\n",address);
    1.77  	printk(KERN_ALERT " printing eip:\n");
    1.78  	printk("%08lx\n", regs->eip);
    1.79 -	page = ((unsigned long *) per_cpu(cur_pgd, smp_processor_id()))
    1.80 -	    [address >> 22];
    1.81 -	printk(KERN_ALERT "*pde = ma %08lx pa %08lx\n", page,
    1.82 -	       machine_to_phys(page));
    1.83 -	/*
    1.84 -	 * We must not directly access the pte in the highpte
    1.85 -	 * case, the page table might be allocated in highmem.
    1.86 -	 * And lets rather not kmap-atomic the pte, just in case
    1.87 -	 * it's allocated already.
    1.88 -	 */
    1.89 -#ifndef CONFIG_HIGHPTE
    1.90 -	if (page & 1) {
    1.91 -		page &= PAGE_MASK;
    1.92 -		address &= 0x003ff000;
    1.93 -		page = machine_to_phys(page);
    1.94 -		page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT];
    1.95 -		printk(KERN_ALERT "*pte = ma %08lx pa %08lx\n", page,
    1.96 -		       machine_to_phys(page));
    1.97 -	}
    1.98 -#endif
    1.99 +	dump_fault_path(address);
   1.100  	die("Oops", regs, error_code);
   1.101  	bust_spinlocks(0);
   1.102  	do_exit(SIGKILL);