direct-io.hg

changeset 2199:be6e22d4e208

bitkeeper revision 1.1159.17.16 (411b37b5pm2GHpK-X97V9DCBq_yjDg)

Fix Xen debug build.
author kaf24@scramble.cl.cam.ac.uk
date Thu Aug 12 09:26:13 2004 +0000 (2004-08-12)
parents 62c8d53c00cf
children adf2043c9382 0213aef0e364 1ee88bcf9566
files xen/arch/x86/memory.c
line diff
     1.1 --- a/xen/arch/x86/memory.c	Thu Aug 12 09:02:27 2004 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Thu Aug 12 09:26:13 2004 +0000
     1.3 @@ -1401,8 +1401,7 @@ void ptwr_flush_inactive(void)
     1.4  
     1.5  int ptwr_do_page_fault(unsigned long addr)
     1.6  {
     1.7 -    /* write page fault, check if we're trying to modify an l1
     1.8 -       page table */
     1.9 +    /* write page fault, check if we're trying to modify an l1 page table */
    1.10      unsigned long pte, pfn;
    1.11      struct pfn_info *page;
    1.12      l2_pgentry_t *pl2e;
    1.13 @@ -1412,19 +1411,21 @@ int ptwr_do_page_fault(unsigned long add
    1.14      PTWR_PRINTK(("get user %p for va %08lx\n",
    1.15                   &linear_pg_table[addr>>PAGE_SHIFT], addr));
    1.16  #endif
    1.17 -    if (l2_pgentry_val(linear_l2_table[addr >> L2_PAGETABLE_SHIFT]) &
    1.18 -        _PAGE_PRESENT &&
    1.19 -        __get_user(pte, (unsigned long *)
    1.20 -                   &linear_pg_table[addr >> PAGE_SHIFT]) == 0) {
    1.21 +    if ( (l2_pgentry_val(linear_l2_table[addr >> L2_PAGETABLE_SHIFT]) &
    1.22 +          _PAGE_PRESENT) &&
    1.23 +         (__get_user(pte, (unsigned long *)
    1.24 +                     &linear_pg_table[addr >> PAGE_SHIFT]) == 0) )
    1.25 +    {
    1.26          pfn = pte >> PAGE_SHIFT;
    1.27  #if 0
    1.28          PTWR_PRINTK(("check pte %08lx = pfn %08lx for va %08lx\n", pte, pfn,
    1.29                       addr));
    1.30  #endif
    1.31          page = &frame_table[pfn];
    1.32 -        if ((page->u.inuse.type_info & PGT_type_mask) == PGT_l1_page_table) {
    1.33 +        if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l1_page_table )
    1.34 +        {
    1.35  #ifdef PTWR_TRACK_DOMAIN
    1.36 -            if (ptwr_info[cpu].domain != get_current()->domain)
    1.37 +            if ( ptwr_info[cpu].domain != get_current()->domain )
    1.38                  printk("ptwr_do_page_fault domain mismatch %d != %d\n",
    1.39                         ptwr_info[cpu].domain, get_current()->domain);
    1.40  #endif
    1.41 @@ -1434,7 +1435,9 @@ int ptwr_do_page_fault(unsigned long add
    1.42                           "pfn %08lx\n", addr,
    1.43                           ((page->u.inuse.type_info & PGT_va_mask) >>
    1.44                            PGT_va_shift) << L2_PAGETABLE_SHIFT, pfn));
    1.45 -            if (l2_pgentry_val(*pl2e) >> PAGE_SHIFT != pfn) {
    1.46 +
    1.47 +            if ( l2_pgentry_val(*pl2e) >> PAGE_SHIFT != pfn )
    1.48 +            {
    1.49                  l1_pgentry_t *pl1e;
    1.50                  PTWR_PRINTK(("[I] freeing l1 page %p taf %08x/%08x\n", page,
    1.51                               page->u.inuse.type_info,
    1.52 @@ -1450,10 +1453,12 @@ int ptwr_do_page_fault(unsigned long add
    1.53                  unmap_domain_mem(pl1e);
    1.54  
    1.55                  ptwr_info[cpu].writable_idx++;
    1.56 -            } else {
    1.57 +            }
    1.58 +            else
    1.59 +            {
    1.60                  l2_pgentry_t nl2e;
    1.61                  l1_pgentry_t *pl1e;
    1.62 -                if (ptwr_info[cpu].disconnected != ENTRIES_PER_L2_PAGETABLE)
    1.63 +                if ( ptwr_info[cpu].disconnected != ENTRIES_PER_L2_PAGETABLE )
    1.64                      ptwr_reconnect_disconnected(addr);
    1.65                  PTWR_PRINTK(("[A]    pl2e %p l2e %08lx pfn %08lx "
    1.66                               "taf %08x/%08x/%u\n", pl2e, l2_pgentry_val(*pl2e),
    1.67 @@ -1481,12 +1486,13 @@ int ptwr_do_page_fault(unsigned long add
    1.68                         ENTRIES_PER_L1_PAGETABLE * sizeof(l1_pgentry_t));
    1.69                  unmap_domain_mem(pl1e);
    1.70              }
    1.71 +
    1.72              /* make pt page writable */
    1.73              pte |= _PAGE_RW;
    1.74              PTWR_PRINTK(("update %p pte to %08lx\n",
    1.75                           &linear_pg_table[addr>>PAGE_SHIFT], pte));
    1.76 -            if (__put_user(pte, (unsigned long *)
    1.77 -                           &linear_pg_table[addr>>PAGE_SHIFT]))
    1.78 +            if ( __put_user(pte, (unsigned long *)
    1.79 +                           &linear_pg_table[addr>>PAGE_SHIFT]) )
    1.80                  BUG();
    1.81              return 1;
    1.82          }
    1.83 @@ -1497,20 +1503,20 @@ int ptwr_do_page_fault(unsigned long add
    1.84  void ptwr_init_backpointers(void)
    1.85  {
    1.86      struct pfn_info *page;
    1.87 -    unsigned long pde, pfn;
    1.88 +    unsigned long pde;
    1.89      int va_idx;
    1.90  
    1.91 -    for (va_idx = 0; va_idx < DOMAIN_ENTRIES_PER_L2_PAGETABLE; va_idx++) {
    1.92 +    for ( va_idx = 0; va_idx < DOMAIN_ENTRIES_PER_L2_PAGETABLE; va_idx++ )
    1.93 +    {
    1.94          /* check if entry valid */
    1.95          pde = l2_pgentry_val(linear_l2_table[va_idx]);
    1.96 -        if ((pde & _PAGE_PRESENT) == 0)
    1.97 +        if ( (pde & _PAGE_PRESENT) == 0 )
    1.98              continue;
    1.99 -        pfn = pde >> PAGE_SHIFT;
   1.100 -        page = &frame_table[pfn];
   1.101 +
   1.102 +        page = &frame_table[pde >> PAGE_SHIFT];
   1.103          /* assert that page is an l1_page_table   XXXcl maybe l2? */
   1.104 -        if ((page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table) {
   1.105 +        if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table )
   1.106              BUG();
   1.107 -        }
   1.108          page->u.inuse.type_info &= ~PGT_va_mask;
   1.109          page->u.inuse.type_info |= va_idx << PGT_va_shift;
   1.110      }
   1.111 @@ -1525,11 +1531,14 @@ void ptwr_status(void)
   1.112      l2_pgentry_t *pl2e;
   1.113      int cpu = smp_processor_id();
   1.114  
   1.115 -    for (i = 0; i < ptwr_info[cpu].writable_idx; i++) {
   1.116 +    for ( i = 0; i < ptwr_info[cpu].writable_idx; i++ )
   1.117 +    {
   1.118          unsigned long *writable_pte = (unsigned long *)&linear_pg_table
   1.119              [ptwr_info[cpu].writables[i]>>PAGE_SHIFT];
   1.120 -        if (__get_user(pte, writable_pte))
   1.121 +
   1.122 +        if ( __get_user(pte, writable_pte) )
   1.123              BUG();
   1.124 +
   1.125          pfn = pte >> PAGE_SHIFT;
   1.126          page = &frame_table[pfn];
   1.127          printk("need to alloc l1 page %p\n", page);
   1.128 @@ -1538,14 +1547,14 @@ void ptwr_status(void)
   1.129                 writable_pte, pte);
   1.130      }
   1.131  
   1.132 -    if (ptwr_info[cpu].disconnected == ENTRIES_PER_L2_PAGETABLE)
   1.133 +    if ( ptwr_info[cpu].disconnected == ENTRIES_PER_L2_PAGETABLE )
   1.134          return;
   1.135  
   1.136      printk("disconnected space: space %08lx\n",
   1.137             ptwr_info[cpu].disconnected << L2_PAGETABLE_SHIFT);
   1.138      pl2e = &linear_l2_table[ptwr_info[cpu].disconnected];
   1.139  
   1.140 -    if (__get_user(pte, ptwr_info[cpu].writable_l1))
   1.141 +    if ( __get_user(pte, (unsigned long *)ptwr_info[cpu].writable_l1) )
   1.142          BUG();
   1.143      pfn = pte >> PAGE_SHIFT;
   1.144      page = &frame_table[pfn];