# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 3f69d30f697d92b415092eba9e47f5ac57823785
# Parent decf309fb47b3f4246540a5e1327663651d266fe
Turn page-structure layout assertions into BUILD_BUG_ON().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r decf309fb47b -r 3f69d30f697d xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Tue May 02 17:23:21 2006 +0100
+++ b/xen/arch/x86/x86_32/mm.c Wed May 03 07:44:20 2006 +0100
@@ -155,17 +155,10 @@ void subarch_init_memory(void)
* 64-bit operations on them. Also, just for sanity, we assert the size
* of the structure here.
*/
- if ( (offsetof(struct page_info, u.inuse._domain) !=
- (offsetof(struct page_info, count_info) + sizeof(u32))) ||
- ((offsetof(struct page_info, count_info) & 7) != 0) ||
- (sizeof(struct page_info) != 24) )
- {
- printk("Weird page_info layout (%ld,%ld,%d)\n",
- offsetof(struct page_info, count_info),
- offsetof(struct page_info, u.inuse._domain),
- sizeof(struct page_info));
- BUG();
- }
+ BUILD_BUG_ON(offsetof(struct page_info, u.inuse._domain) !=
+ (offsetof(struct page_info, count_info) + sizeof(u32)));
+ BUILD_BUG_ON((offsetof(struct page_info, count_info) & 7) != 0);
+ BUILD_BUG_ON(sizeof(struct page_info) != 24);
/* M2P table is mappable read-only by privileged domains. */
for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
diff -r decf309fb47b -r 3f69d30f697d xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c Tue May 02 17:23:21 2006 +0100
+++ b/xen/arch/x86/x86_64/mm.c Wed May 03 07:44:20 2006 +0100
@@ -145,19 +145,11 @@ void subarch_init_memory(void)
* count_info and domain fields must be adjacent, as we perform atomic
* 64-bit operations on them.
*/
- if ( ((offsetof(struct page_info, u.inuse._domain) !=
- (offsetof(struct page_info, count_info) + sizeof(u32)))) ||
- ((offsetof(struct page_info, count_info) & 7) != 0) ||
- (sizeof(struct page_info) !=
- (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long))) )
- {
- printk("Weird page_info layout (%ld,%ld,%ld,%ld)\n",
- offsetof(struct page_info, count_info),
- offsetof(struct page_info, u.inuse._domain),
- sizeof(struct page_info),
- 32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long));
- for ( ; ; ) ;
- }
+ BUILD_BUG_ON(offsetof(struct page_info, u.inuse._domain) !=
+ (offsetof(struct page_info, count_info) + sizeof(u32)));
+ BUILD_BUG_ON((offsetof(struct page_info, count_info) & 7) != 0);
+ BUILD_BUG_ON(sizeof(struct page_info) !=
+ (32 + BITS_TO_LONGS(NR_CPUS)*sizeof(long)));
/* M2P table is mappable read-only by privileged domains. */
for ( v = RDWR_MPT_VIRT_START;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|