]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Use a linker ASSERT() to check that the mappings are within l1_identmap[]
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 22 Mar 2018 11:50:50 +0000 (11:50 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 7 Apr 2018 19:56:40 +0000 (20:56 +0100)
This avoids needing the runtime checks in hvm's arch_init_traps()

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/hvm/traps.c
arch/x86/link.lds.S

index 9d732e6002492f250f610105ba2d0ca673717cee..96374aa6d5a8e89fb960bf4de8914722e3d3b93d 100644 (file)
@@ -133,17 +133,11 @@ void arch_init_traps(void)
     {
         unsigned long gfn = virt_to_gfn(user_stack);
 
-        if ( gfn >= ARRAY_SIZE(l1_identmap) )
-            panic("user_stack[] outside of l1_identmap[]\n");
-
         l1_identmap[gfn] |= _PAGE_USER;
 
         extern const char __start_user_text[], __end_user_text[];
         unsigned long end = virt_to_gfn(__end_user_text);
 
-        if ( gfn >= ARRAY_SIZE(l1_identmap) )
-            panic("__{start,end}_user_text[] outside of l1_identmap[]\n");
-
         for ( gfn = virt_to_gfn(__start_user_text); gfn < end; ++gfn )
             l1_identmap[gfn] |= _PAGE_USER;
 
index 03c94556c529b6d9b7570f7ecd58283a836a91f8..db77d3555a4ce44a13266b496ddecce23423b65c 100644 (file)
@@ -92,6 +92,9 @@ ASSERT(IS_ALIGNED(__end_user_text,   PAGE_SIZE), "__end_user_text misaligned");
 
 #ifdef CONFIG_HVM
 
+/* Check everything lives within l1_identmap[] for user and r/o mappings. */
+ASSERT(_end < (1 << (PT_ORDER + PAGE_SHIFT)), "Mappings exceed l1_identmap[]");
+
 ASSERT(IS_ALIGNED(pae_l1_identmap, PAGE_SIZE), "pae_l1_identmap misaligned");
 ASSERT(IS_ALIGNED(pae_l2_identmap, PAGE_SIZE), "pae_l2_identmap misaligned");
 ASSERT(IS_ALIGNED(pae_l3_identmap, PAGE_SIZE), "pae_l3_identmap misaligned");