ia64/xen-unstable

changeset 3649:715c644ba9ef

bitkeeper revision 1.1159.212.86 (4203944ddTnTLXj6fYycRHIqY8hdCQ)

Fix 64-bit domain builder to correctly determine required number of
page-table pages to build DOM0 image.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Fri Feb 04 15:27:09 2005 +0000 (2005-02-04)
parents 5c112b235281
children 8c6281ec8860
files xen/arch/x86/x86_64/domain_build.c
line diff
     1.1 --- a/xen/arch/x86/x86_64/domain_build.c	Fri Feb 04 14:48:37 2005 +0000
     1.2 +++ b/xen/arch/x86/x86_64/domain_build.c	Fri Feb 04 15:27:09 2005 +0000
     1.3 @@ -130,15 +130,13 @@ int construct_dom0(struct domain *d,
     1.4          v_end            = (vstack_end + (1UL<<22)-1) & ~((1UL<<22)-1);
     1.5          if ( (v_end - vstack_end) < (512UL << 10) )
     1.6              v_end += 1UL << 22; /* Add extra 4MB to get >= 512kB padding. */
     1.7 -#define RD(_p,_s) ((_p) >> (_s))                      /* round up */
     1.8 -#define RU(_p,_s) (((_p) + ((1UL<<(_s))-1)) >> (_s))  /* round down */
     1.9 +#define NR(_l,_h,_s) \
    1.10 +    (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
    1.11 +       ((_l) & ~((1UL<<(_s))-1))) >> (_s))
    1.12          if ( (1 + /* # L4 */
    1.13 -              (RU(v_end, L4_PAGETABLE_SHIFT) - 
    1.14 -               RD(dsi.v_start, L4_PAGETABLE_SHIFT)) + /* # L3 */
    1.15 -              (RU(v_end, L3_PAGETABLE_SHIFT) - 
    1.16 -               RD(dsi.v_start, L3_PAGETABLE_SHIFT)) + /* # L2 */
    1.17 -              (RU(v_end, L2_PAGETABLE_SHIFT) - 
    1.18 -               RD(dsi.v_start, L2_PAGETABLE_SHIFT)))  /* # L1 */
    1.19 +              NR(dsi.v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
    1.20 +              NR(dsi.v_start, v_end, L3_PAGETABLE_SHIFT) + /* # L2 */
    1.21 +              NR(dsi.v_start, v_end, L2_PAGETABLE_SHIFT))  /* # L1 */
    1.22               <= nr_pt_pages )
    1.23              break;
    1.24      }