[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V3 3/4] arm: add build time asserts for various virtual address aligment constraints



Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
---
Not totally sold on the need for this, but I guess it is harmless enough...
---
 xen/arch/arm/mm.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 3cb852b..656aa82 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -74,6 +74,17 @@ unsigned long total_pages;
 
 extern char __init_begin[], __init_end[];
 
+/* Checking VA memory layout alignment. */
+static inline void check_memory_layout_alignment_constraints(void) {
+    /* 2MB aligned regions */
+    BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
+    BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);
+    BUILD_BUG_ON(BOOT_MISC_VIRT_START & ~SECOND_MASK);
+    /* 1GB aligned regions */
+    BUILD_BUG_ON(XENHEAP_VIRT_START & ~FIRST_MASK);
+    BUILD_BUG_ON(DOMHEAP_VIRT_START & ~FIRST_MASK);
+}
+
 void dump_pt_walk(lpae_t *first, paddr_t addr)
 {
     lpae_t *second = NULL, *third = NULL;
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.