ia64/xen-unstable

changeset 18683:f7c09997cf11

x86, shadow: shadow_page_info must be same size as page_info.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Oct 21 14:15:11 2008 +0100 (2008-10-21)
parents e7f876c94955
children d2f7243fc571
files xen/arch/x86/mm/shadow/private.h
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/private.h	Tue Oct 21 14:14:37 2008 +0100
     1.2 +++ b/xen/arch/x86/mm/shadow/private.h	Tue Oct 21 14:15:11 2008 +0100
     1.3 @@ -227,32 +227,40 @@ extern void shadow_audit_tables(struct v
     1.4  struct shadow_page_info
     1.5  {
     1.6      union {
     1.7 -        /* When in use, guest page we're a shadow of */
     1.8 -        unsigned long backpointer;
     1.9 -        /* When free, order of the freelist we're on */
    1.10 -        unsigned int order;
    1.11 -    };
    1.12 -    union {
    1.13 -        /* When in use, next shadow in this hash chain */
    1.14 -        struct shadow_page_info *next_shadow;
    1.15 -        /* When free, TLB flush time when freed */
    1.16 -        u32 tlbflush_timestamp;
    1.17 -    };
    1.18 -    struct {
    1.19 -        unsigned int type:5;      /* What kind of shadow is this? */
    1.20 -        unsigned int pinned:1;    /* Is the shadow pinned? */
    1.21 -        unsigned int count:26;    /* Reference count */
    1.22 -        u32 mbz;                  /* Must be zero: this is where the owner 
    1.23 -                                   * field lives in a non-shadow page */
    1.24 -    } __attribute__((packed));
    1.25 -    union {
    1.26 -        /* For unused shadow pages, a list of pages of this order; 
    1.27 -         * for pinnable shadows, if pinned, a list of other pinned shadows
    1.28 -         * (see sh_type_is_pinnable() below for the definition of 
    1.29 -         * "pinnable" shadow types). */
    1.30 -        struct list_head list;
    1.31 -        /* For non-pinnable shadows, a higher entry that points at us */
    1.32 -        paddr_t up;
    1.33 +        /* Ensures that shadow_page_info is same size as page_info. */
    1.34 +        struct page_info page_info;
    1.35 +
    1.36 +        struct {
    1.37 +            union {
    1.38 +                /* When in use, guest page we're a shadow of */
    1.39 +                unsigned long backpointer;
    1.40 +                /* When free, order of the freelist we're on */
    1.41 +                unsigned int order;
    1.42 +            };
    1.43 +            union {
    1.44 +                /* When in use, next shadow in this hash chain */
    1.45 +                struct shadow_page_info *next_shadow;
    1.46 +                /* When free, TLB flush time when freed */
    1.47 +                u32 tlbflush_timestamp;
    1.48 +            };
    1.49 +            struct {
    1.50 +                unsigned int type:5;   /* What kind of shadow is this? */
    1.51 +                unsigned int pinned:1; /* Is the shadow pinned? */
    1.52 +                unsigned int count:26; /* Reference count */
    1.53 +                u32 mbz;               /* Must be zero: this is where the
    1.54 +                                        * owner field lives in page_info */
    1.55 +            } __attribute__((packed));
    1.56 +            union {
    1.57 +                /* For unused shadow pages, a list of pages of this order; for 
    1.58 +                 * pinnable shadows, if pinned, a list of other pinned shadows
    1.59 +                 * (see sh_type_is_pinnable() below for the definition of 
    1.60 +                 * "pinnable" shadow types). */
    1.61 +                struct list_head list;
    1.62 +                /* For non-pinnable shadows, a higher entry that points
    1.63 +                 * at us. */
    1.64 +                paddr_t up;
    1.65 +            };
    1.66 +        };
    1.67      };
    1.68  };
    1.69  
    1.70 @@ -261,7 +269,8 @@ struct shadow_page_info
    1.71   * Also, the mbz field must line up with the owner field of normal 
    1.72   * pages, so they look properly like anonymous/xen pages. */
    1.73  static inline void shadow_check_page_struct_offsets(void) {
    1.74 -    BUILD_BUG_ON(sizeof (struct shadow_page_info) > sizeof (struct page_info));
    1.75 +    BUILD_BUG_ON(sizeof (struct shadow_page_info) !=
    1.76 +                 sizeof (struct page_info));
    1.77      BUILD_BUG_ON(offsetof(struct shadow_page_info, mbz) !=
    1.78                   offsetof(struct page_info, u.inuse._domain));
    1.79  };