direct-io.hg

changeset 6805:5e943af66571

Add some sanity check when creating 3-level 1:1 page table
in VMX domain builder.
- Add check for empty l2e page entry.
- Add check for failed vl1tab map.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Asit Mallick <asit.k.mallick@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 14 13:34:14 2005 +0000 (2005-09-14)
parents 1cdc469bf78d
children 5959fae4722a
files tools/libxc/xc_vmx_build.c
line diff
     1.1 --- a/tools/libxc/xc_vmx_build.c	Wed Sep 14 13:28:45 2005 +0000
     1.2 +++ b/tools/libxc/xc_vmx_build.c	Wed Sep 14 13:34:14 2005 +0000
     1.3 @@ -169,21 +169,35 @@ static int zap_mmio_range(int xc_handle,
     1.4     l2_pgentry_t *vl2tab;
     1.5   
     1.6     mmio_addr = mmio_range_start & PAGE_MASK;
     1.7 -   for (; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE) {
     1.8 +   for ( ; mmio_addr < mmio_range_end; mmio_addr += PAGE_SIZE )
     1.9 +   {
    1.10         vl3e = vl3tab[l3_table_offset(mmio_addr)];
    1.11 -       if (vl3e == 0)
    1.12 +       if ( vl3e == 0 )
    1.13             continue;
    1.14 -       vl2tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    1.15 -               PROT_READ|PROT_WRITE, vl3e >> PAGE_SHIFT);
    1.16 -       if (vl2tab == 0) {
    1.17 +
    1.18 +       vl2tab = xc_map_foreign_range(
    1.19 +           xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl3e>>PAGE_SHIFT);
    1.20 +       if ( vl2tab == NULL )
    1.21 +       {
    1.22             PERROR("Failed zap MMIO range");
    1.23             return -1;
    1.24         }
    1.25 +
    1.26         vl2e = vl2tab[l2_table_offset(mmio_addr)];
    1.27 -       if (vl2e == 0)
    1.28 +       if ( vl2e == 0 )
    1.29 +       {
    1.30 +           munmap(vl2tab, PAGE_SIZE);
    1.31             continue;
    1.32 -       vl1tab = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
    1.33 -               PROT_READ|PROT_WRITE, vl2e >> PAGE_SHIFT);
    1.34 +       }
    1.35 +
    1.36 +       vl1tab = xc_map_foreign_range(
    1.37 +           xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, vl2e>>PAGE_SHIFT);
    1.38 +       if ( vl1tab == NULL )
    1.39 +       {
    1.40 +           PERROR("Failed zap MMIO range");
    1.41 +           munmap(vl2tab, PAGE_SIZE);
    1.42 +           return -1;
    1.43 +       }
    1.44  
    1.45         vl1tab[l1_table_offset(mmio_addr)] = 0;
    1.46         munmap(vl2tab, PAGE_SIZE);