ia64/xen-unstable

changeset 8702:6411e42ae497

Re-arrange things in the domain builder a bit so as to make sure that
when we make a page below 4G in the domain, that gets reflected into
the M2P and P2M tables.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
author sos22@douglas.cl.cam.ac.uk
date Mon Jan 30 12:53:33 2006 +0100 (2006-01-30)
parents 4cce50ba4520
children 58d6a94cd163
files tools/libxc/xc_linux_build.c
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Sun Jan 29 10:55:28 2006 +0100
     1.2 +++ b/tools/libxc/xc_linux_build.c	Mon Jan 30 12:53:33 2006 +0100
     1.3 @@ -654,6 +654,60 @@ static int setup_guest(int xc_handle,
     1.4          }
     1.5      }
     1.6  
     1.7 +    /* setup page tables */
     1.8 +#if defined(__i386__)
     1.9 +    if (dsi.pae_kernel)
    1.10 +        rc = setup_pg_tables_pae(xc_handle, dom, ctxt,
    1.11 +                                 dsi.v_start, v_end,
    1.12 +                                 page_array, vpt_start, vpt_end,
    1.13 +                                 shadow_mode_enabled);
    1.14 +    else
    1.15 +        rc = setup_pg_tables(xc_handle, dom, ctxt,
    1.16 +                             dsi.v_start, v_end,
    1.17 +                             page_array, vpt_start, vpt_end,
    1.18 +                             shadow_mode_enabled);
    1.19 +#endif
    1.20 +#if defined(__x86_64__)
    1.21 +    rc = setup_pg_tables_64(xc_handle, dom, ctxt,
    1.22 +                            dsi.v_start, v_end,
    1.23 +                            page_array, vpt_start, vpt_end,
    1.24 +                            shadow_mode_enabled);
    1.25 +#endif
    1.26 +    if (0 != rc)
    1.27 +        goto error_out;
    1.28 +
    1.29 +#if defined(__i386__)
    1.30 +    /*
    1.31 +     * Pin down l2tab addr as page dir page - causes hypervisor to provide
    1.32 +     * correct protection for the page
    1.33 +     */
    1.34 +    if ( !shadow_mode_enabled )
    1.35 +    {
    1.36 +        if ( dsi.pae_kernel )
    1.37 +        {
    1.38 +            if ( pin_table(xc_handle, MMUEXT_PIN_L3_TABLE,
    1.39 +                           ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
    1.40 +                goto error_out;
    1.41 +        }
    1.42 +        else
    1.43 +        {
    1.44 +            if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE,
    1.45 +                           ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
    1.46 +                goto error_out;
    1.47 +        }
    1.48 +    }
    1.49 +#endif
    1.50 +
    1.51 +#if defined(__x86_64__)
    1.52 +    /*
    1.53 +     * Pin down l4tab addr as page dir page - causes hypervisor to  provide
    1.54 +     * correct protection for the page
    1.55 +     */
    1.56 +    if ( pin_table(xc_handle, MMUEXT_PIN_L4_TABLE,
    1.57 +                   ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
    1.58 +        goto error_out;
    1.59 +#endif
    1.60 +
    1.61      if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
    1.62          goto error_out;
    1.63  
    1.64 @@ -720,60 +774,6 @@ static int setup_guest(int xc_handle,
    1.65          guest_shared_info_mfn = shared_info_frame;
    1.66      }
    1.67  
    1.68 -    /* setup page tables */
    1.69 -#if defined(__i386__)
    1.70 -    if (dsi.pae_kernel)
    1.71 -        rc = setup_pg_tables_pae(xc_handle, dom, ctxt,
    1.72 -                                 dsi.v_start, v_end,
    1.73 -                                 page_array, vpt_start, vpt_end,
    1.74 -                                 shadow_mode_enabled);
    1.75 -    else
    1.76 -        rc = setup_pg_tables(xc_handle, dom, ctxt,
    1.77 -                             dsi.v_start, v_end,
    1.78 -                             page_array, vpt_start, vpt_end,
    1.79 -                             shadow_mode_enabled);
    1.80 -#endif
    1.81 -#if defined(__x86_64__)
    1.82 -    rc = setup_pg_tables_64(xc_handle, dom, ctxt,
    1.83 -                            dsi.v_start, v_end,
    1.84 -                            page_array, vpt_start, vpt_end,
    1.85 -                            shadow_mode_enabled);
    1.86 -#endif
    1.87 -    if (0 != rc)
    1.88 -        goto error_out;
    1.89 -
    1.90 -#if defined(__i386__)
    1.91 -    /*
    1.92 -     * Pin down l2tab addr as page dir page - causes hypervisor to provide
    1.93 -     * correct protection for the page
    1.94 -     */
    1.95 -    if ( !shadow_mode_enabled )
    1.96 -    {
    1.97 -        if ( dsi.pae_kernel )
    1.98 -        {
    1.99 -            if ( pin_table(xc_handle, MMUEXT_PIN_L3_TABLE,
   1.100 -                           ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
   1.101 -                goto error_out;
   1.102 -        }
   1.103 -        else
   1.104 -        {
   1.105 -            if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE,
   1.106 -                           ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
   1.107 -                goto error_out;
   1.108 -        }
   1.109 -    }
   1.110 -#endif
   1.111 -
   1.112 -#if defined(__x86_64__)
   1.113 -    /*
   1.114 -     * Pin down l4tab addr as page dir page - causes hypervisor to  provide
   1.115 -     * correct protection for the page
   1.116 -     */
   1.117 -    if ( pin_table(xc_handle, MMUEXT_PIN_L4_TABLE,
   1.118 -                   ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) )
   1.119 -        goto error_out;
   1.120 -#endif
   1.121 -
   1.122      *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
   1.123      *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT];
   1.124      if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) ||