ia64/xen-unstable

changeset 9921:3f69d30f697d

Turn page-structure layout assertions into BUILD_BUG_ON().
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed May 03 07:44:20 2006 +0100 (2006-05-03)
parents decf309fb47b
children e1409c2ace46
files xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_64/mm.c
line diff
     1.1 --- a/xen/arch/x86/x86_32/mm.c	Tue May 02 17:23:21 2006 +0100
     1.2 +++ b/xen/arch/x86/x86_32/mm.c	Wed May 03 07:44:20 2006 +0100
     1.3 @@ -155,17 +155,10 @@ void subarch_init_memory(void)
     1.4       * 64-bit operations on them. Also, just for sanity, we assert the size
     1.5       * of the structure here.
     1.6       */
     1.7 -    if ( (offsetof(struct page_info, u.inuse._domain) != 
     1.8 -          (offsetof(struct page_info, count_info) + sizeof(u32))) ||
     1.9 -         ((offsetof(struct page_info, count_info) & 7) != 0) ||
    1.10 -         (sizeof(struct page_info) != 24) )
    1.11 -    {
    1.12 -        printk("Weird page_info layout (%ld,%ld,%d)\n",
    1.13 -               offsetof(struct page_info, count_info),
    1.14 -               offsetof(struct page_info, u.inuse._domain),
    1.15 -               sizeof(struct page_info));
    1.16 -        BUG();
    1.17 -    }
    1.18 +    BUILD_BUG_ON(offsetof(struct page_info, u.inuse._domain) != 
    1.19 +                 (offsetof(struct page_info, count_info) + sizeof(u32)));
    1.20 +    BUILD_BUG_ON((offsetof(struct page_info, count_info) & 7) != 0);
    1.21 +    BUILD_BUG_ON(sizeof(struct page_info) != 24);
    1.22  
    1.23      /* M2P table is mappable read-only by privileged domains. */
    1.24      for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     2.1 --- a/xen/arch/x86/x86_64/mm.c	Tue May 02 17:23:21 2006 +0100
     2.2 +++ b/xen/arch/x86/x86_64/mm.c	Wed May 03 07:44:20 2006 +0100
     2.3 @@ -145,19 +145,11 @@ void subarch_init_memory(void)
     2.4       * count_info and domain fields must be adjacent, as we perform atomic
     2.5       * 64-bit operations on them.
     2.6       */
     2.7 -    if ( ((offsetof(struct page_info, u.inuse._domain) != 
     2.8 -           (offsetof(struct page_info, count_info) + sizeof(u32)))) ||
     2.9 -         ((offsetof(struct page_info, count_info) & 7) != 0) ||
    2.10 -         (sizeof(struct page_info) !=
    2.11 -          (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long))) )
    2.12 -    {
    2.13 -        printk("Weird page_info layout (%ld,%ld,%ld,%ld)\n",
    2.14 -               offsetof(struct page_info, count_info),
    2.15 -               offsetof(struct page_info, u.inuse._domain),
    2.16 -               sizeof(struct page_info),
    2.17 -               32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long));
    2.18 -        for ( ; ; ) ;
    2.19 -    }
    2.20 +    BUILD_BUG_ON(offsetof(struct page_info, u.inuse._domain) != 
    2.21 +                 (offsetof(struct page_info, count_info) + sizeof(u32)));
    2.22 +    BUILD_BUG_ON((offsetof(struct page_info, count_info) & 7) != 0);
    2.23 +    BUILD_BUG_ON(sizeof(struct page_info) !=
    2.24 +                 (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long)));
    2.25  
    2.26      /* M2P table is mappable read-only by privileged domains. */
    2.27      for ( v  = RDWR_MPT_VIRT_START;