ia64/xen-unstable

changeset 2377:6090073bceb8

bitkeeper revision 1.1159.53.15 (412f59edRaPtLEKZVDbeN6zipq6gyA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
author cl349@freefall.cl.cam.ac.uk
date Fri Aug 27 15:57:33 2004 +0000 (2004-08-27)
parents 1d22184ac072 9fd44cd4f9cb
children f5ee3532bda7 b078dc2c118f
files xen/arch/x86/memory.c xen/common/domain.c
line diff
     1.1 --- a/xen/arch/x86/memory.c	Fri Aug 27 15:27:44 2004 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Fri Aug 27 15:57:33 2004 +0000
     1.3 @@ -1488,8 +1488,10 @@ void ptwr_reconnect_disconnected(unsigne
     1.4                   addr, ptwr_info[cpu].disconnected << L2_PAGETABLE_SHIFT));
     1.5      pl2e = &linear_l2_table[ptwr_info[cpu].disconnected];
     1.6  
     1.7 -    if (__get_user(pte, writable_pte))
     1.8 -        BUG();
     1.9 +    if (__get_user(pte, writable_pte)) {
    1.10 +	MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte);
    1.11 +	domain_crash();
    1.12 +    }
    1.13      pfn = pte >> PAGE_SHIFT;
    1.14      page = &frame_table[pfn];
    1.15  
    1.16 @@ -1512,8 +1514,10 @@ void ptwr_reconnect_disconnected(unsigne
    1.17              continue;
    1.18          if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT))
    1.19              put_page_from_l1e(ol1e, current);
    1.20 -        if (unlikely(!get_page_from_l1e(nl1e, current)))
    1.21 -            BUG();
    1.22 +        if (unlikely(!get_page_from_l1e(nl1e, current))) {
    1.23 +	    MEM_LOG("ptwr: Could not re-validate l1 page\n");
    1.24 +	    domain_crash();
    1.25 +	}
    1.26      }
    1.27      unmap_domain_mem(pl1e);
    1.28      update_l2e(pl2e, *pl2e, nl2e);
    1.29 @@ -1525,13 +1529,17 @@ void ptwr_reconnect_disconnected(unsigne
    1.30                   frame_table[pfn].u.inuse.domain->domain));
    1.31      ptwr_info[cpu].disconnected = ENTRIES_PER_L2_PAGETABLE;
    1.32      /* make pt page write protected */
    1.33 -    if (__get_user(pte, writable_pte))
    1.34 -        BUG();
    1.35 +    if (__get_user(pte, writable_pte)) {
    1.36 +	MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte);
    1.37 +	domain_crash();
    1.38 +    }
    1.39      PTWR_PRINTK(("[A] writable_l1 at %p is %08lx\n",
    1.40                   writable_pte, pte));
    1.41      pte &= ~_PAGE_RW;
    1.42 -    if (__put_user(pte, writable_pte))
    1.43 -        BUG();
    1.44 +    if (__put_user(pte, writable_pte)) {
    1.45 +	MEM_LOG("ptwr: Could not update pte at %p\n", writable_pte);
    1.46 +	domain_crash();
    1.47 +    }
    1.48      __flush_tlb_one(ptwr_info[cpu].writable_l1);
    1.49      PTWR_PRINTK(("[A] writable_l1 at %p now %08lx\n",
    1.50                   writable_pte, pte));
    1.51 @@ -1564,8 +1572,10 @@ void ptwr_flush_inactive(void)
    1.52      for (idx = 0; idx < ptwr_info[cpu].writable_idx; idx++) {
    1.53          unsigned long *writable_pte = (unsigned long *)&linear_pg_table
    1.54              [ptwr_info[cpu].writables[idx]>>PAGE_SHIFT];
    1.55 -        if (__get_user(pte, writable_pte))
    1.56 -            BUG();
    1.57 +        if (__get_user(pte, writable_pte)) {
    1.58 +	    MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte);
    1.59 +	    domain_crash();
    1.60 +	}
    1.61          pfn = pte >> PAGE_SHIFT;
    1.62          page = &frame_table[pfn];
    1.63          PTWR_PRINTK(("[I] alloc l1 page %p\n", page));
    1.64 @@ -1579,8 +1589,10 @@ void ptwr_flush_inactive(void)
    1.65                  continue;
    1.66              if (unlikely(l1_pgentry_val(ol1e) & _PAGE_PRESENT))
    1.67                  put_page_from_l1e(ol1e, current);
    1.68 -            if (unlikely(!get_page_from_l1e(nl1e, current)))
    1.69 -                BUG();
    1.70 +            if (unlikely(!get_page_from_l1e(nl1e, current))) {
    1.71 +		MEM_LOG("ptwr: Could not re-validate l1 page\n");
    1.72 +		domain_crash();
    1.73 +	    }
    1.74          }
    1.75          unmap_domain_mem(pl1e);
    1.76  
    1.77 @@ -1588,8 +1600,10 @@ void ptwr_flush_inactive(void)
    1.78          PTWR_PRINTK(("[I] writable_l1 at %p is %08lx\n",
    1.79                       writable_pte, pte));
    1.80          pte &= ~_PAGE_RW;
    1.81 -        if (__put_user(pte, writable_pte))
    1.82 -            BUG();
    1.83 +        if (__put_user(pte, writable_pte)) {
    1.84 +	    MEM_LOG("ptwr: Could not update pte at %p\n", writable_pte);
    1.85 +	    domain_crash();
    1.86 +	}
    1.87          __flush_tlb_one(ptwr_info[cpu].writables[idx]);
    1.88          PTWR_PRINTK(("[I] writable_l1 at %p now %08lx\n",
    1.89                       writable_pte, pte));
    1.90 @@ -1690,8 +1704,11 @@ int ptwr_do_page_fault(unsigned long add
    1.91              PTWR_PRINTK(("update %p pte to %08lx\n",
    1.92                           &linear_pg_table[addr>>PAGE_SHIFT], pte));
    1.93              if ( __put_user(pte, (unsigned long *)
    1.94 -                           &linear_pg_table[addr>>PAGE_SHIFT]) )
    1.95 -                BUG();
    1.96 +			    &linear_pg_table[addr>>PAGE_SHIFT]) ) {
    1.97 +		MEM_LOG("ptwr: Could not update pte at %p\n", (unsigned long *)
    1.98 +			&linear_pg_table[addr>>PAGE_SHIFT]);
    1.99 +		domain_crash();
   1.100 +	    }
   1.101              return 1;
   1.102          }
   1.103      }
   1.104 @@ -1713,8 +1730,11 @@ static void ptwr_init_backpointers(void)
   1.105  
   1.106          page = &frame_table[pde >> PAGE_SHIFT];
   1.107          /* assert that page is an l1_page_table   XXXcl maybe l2? */
   1.108 -        if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table )
   1.109 -            BUG();
   1.110 +        if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table ) {
   1.111 +	    MEM_LOG("ptwr: Inconsistent pagetable: pde %x is not an l1 page\n",
   1.112 +		    pde >> PAGE_SHIFT);
   1.113 +	    domain_crash();
   1.114 +	}
   1.115          page->u.inuse.type_info &= ~PGT_va_mask;
   1.116          page->u.inuse.type_info |= va_idx << PGT_va_shift;
   1.117      }
   1.118 @@ -1739,8 +1759,10 @@ void ptwr_status(void)
   1.119          unsigned long *writable_pte = (unsigned long *)&linear_pg_table
   1.120              [ptwr_info[cpu].writables[i]>>PAGE_SHIFT];
   1.121  
   1.122 -        if ( __get_user(pte, writable_pte) )
   1.123 -            BUG();
   1.124 +        if ( __get_user(pte, writable_pte) ) {
   1.125 +	    MEM_LOG("ptwr: Could not read pte at %p\n", writable_pte);
   1.126 +	    domain_crash();
   1.127 +	}
   1.128  
   1.129          pfn = pte >> PAGE_SHIFT;
   1.130          page = &frame_table[pfn];
   1.131 @@ -1757,8 +1779,11 @@ void ptwr_status(void)
   1.132             ptwr_info[cpu].disconnected << L2_PAGETABLE_SHIFT);
   1.133      pl2e = &linear_l2_table[ptwr_info[cpu].disconnected];
   1.134  
   1.135 -    if ( __get_user(pte, (unsigned long *)ptwr_info[cpu].writable_l1) )
   1.136 -        BUG();
   1.137 +    if ( __get_user(pte, (unsigned long *)ptwr_info[cpu].writable_l1) ) {
   1.138 +	MEM_LOG("ptwr: Could not read pte at %p\n", (unsigned long *)
   1.139 +		ptwr_info[cpu].writable_l1);
   1.140 +	domain_crash();
   1.141 +    }
   1.142      pfn = pte >> PAGE_SHIFT;
   1.143      page = &frame_table[pfn];
   1.144  
     2.1 --- a/xen/common/domain.c	Fri Aug 27 15:27:44 2004 +0000
     2.2 +++ b/xen/common/domain.c	Fri Aug 27 15:57:33 2004 +0000
     2.3 @@ -152,6 +152,9 @@ void domain_crash(void)
     2.4  {
     2.5      struct domain *d;
     2.6  
     2.7 +    if (current->domain == 0)
     2.8 +	BUG();
     2.9 +
    2.10      set_bit(DF_CRASHED, &current->flags);
    2.11  
    2.12      d = find_domain_by_id(0);