]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Separate page aligned data/bss into separate sections
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 18 Oct 2016 13:08:00 +0000 (13:08 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 22 May 2017 12:21:25 +0000 (13:21 +0100)
This alone drops the size of HVM tests by 8k.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/hvm/pagetables.S
arch/x86/hypercall_page.S
arch/x86/link.lds.S
arch/x86/setup.c
include/xtf/compiler.h
tests/xsa-170/main.c
tests/xsa-173/main.c
tests/xsa-186/main.c
tests/xsa-188/main.c
tests/xsa-195/main.c

index 61c98e885c73d10b1c1eeddaf2f4e46f405c09d5..ee9bf42c5241a26d9f208dace1b892c4e68668cf 100644 (file)
@@ -16,7 +16,7 @@
 #define PAE_IDX(sym) ((. - (sym)) / PAE_PTE_SIZE)
 #define PSE_IDX(sym) ((. - (sym)) / PSE_PTE_SIZE)
 
-        .data
+        .section ".data.page_aligned", "aw"
         .p2align PAGE_SHIFT
 
 /* PAE mappings of first 2M of memory in 4k pages. Uses 1x 4k page. */
@@ -72,6 +72,8 @@ PAGETABLE_START(pse_l2_identmap)
 PAGETABLE_END(pse_l2_identmap)
 .Lpse_l2_identmap_end:
 
+        .data
+        .align 32
 /* PAE l3 32bit quad.  Contains 4 64bit entries. */
 PAGETABLE_START(pae32_l3_identmap)
         .rept PAE32_L3_ENTRIES
index 94a783416a066863814a887bb7cecafcb118a48c..4787f096c831506359c64b17def9e8e7102a9858 100644 (file)
@@ -2,8 +2,9 @@
 #include <xtf/asm_macros.h>
 #include <xen/xen.h>
 
-.data
-.align PAGE_SIZE
+        .section ".data.page_aligned", "aw"
+        .p2align PAGE_SHIFT
+
 GLOBAL(hypercall_page)
          /* Poisoned with `ret` for safety before hypercalls are set up. */
         .fill PAGE_SIZE, 1, 0xc3
index 3941858f7d12ecd69fecd9be4d6a3bc50a66b4b3..736659a6bd50b401640d3d8530f908c9ecd6062a 100644 (file)
@@ -47,6 +47,9 @@ SECTIONS
 
         .data : {
                 *(.data)
+        . = ALIGN(PAGE_SIZE);
+                *(.data.page_aligned)
+        . = ALIGN(PAGE_SIZE);
         }
 
         .rodata : {
@@ -66,6 +69,9 @@ SECTIONS
 
         .bss : {
                 *(.bss)
+        . = ALIGN(PAGE_SIZE);
+                *(.bss.page_aligned)
+        . = ALIGN(PAGE_SIZE);
         }
 
         _end = .;
index f64f22f1b2fca993fddd1780402ba84b4be7c864..bd2a5056973c65431da9c332218f0391858cc190 100644 (file)
@@ -16,8 +16,9 @@
  * boot_stack[page 2] Exception entrypoints
  * boot_stack[page 1] Top of work stack
  */
-uint8_t boot_stack[3 * PAGE_SIZE] __aligned(PAGE_SIZE);
-uint8_t user_stack[PAGE_SIZE] __aligned(PAGE_SIZE);
+uint8_t boot_stack[3 * PAGE_SIZE] __page_aligned_bss;
+uint8_t user_stack[PAGE_SIZE] __page_aligned_bss;
+
 uint32_t x86_features[FSCAPINTS];
 enum x86_vendor x86_vendor;
 unsigned int max_leaf, max_extd_leaf;
index 9875b50960a0a6c586fe1dbf89bf5850eb2eaa08..11a516c4921f65c52a158ddcd1e039ad128626dd 100644 (file)
@@ -22,6 +22,8 @@
 
 /* Convenience wrappers. */
 #define __user_text           __section(".text.user")
+#define __page_aligned_data   __section(".data.page_aligned") __aligned(4096)
+#define __page_aligned_bss    __section(".bss.page_aligned")  __aligned(4096)
 
 #endif /* XTF_COMPILER_H */
 
index c8fbf18b85805bcab27d46c33251ad74dae51030..f8b4c1b7595a5825c695595eeb8cc21e336ae94b 100644 (file)
@@ -61,9 +61,9 @@ void nop_slide(void)
 
 void test_main(void)
 {
-    static intpte_t nl2t[L2_PT_ENTRIES] __aligned(PAGE_SIZE);
-    static intpte_t nl1t[L1_PT_ENTRIES] __aligned(PAGE_SIZE);
-    static uint8_t  buffer[PAGE_SIZE] __aligned(PAGE_SIZE);
+    static intpte_t nl2t[L2_PT_ENTRIES] __page_aligned_bss;
+    static intpte_t nl1t[L1_PT_ENTRIES] __page_aligned_bss;
+    static uint8_t  buffer[PAGE_SIZE] __page_aligned_bss;
 
     printk("  Executing user wild jump\n");
     exec_user_void(wild_jump);
index a4bc6de6a89b28b1891d58d7368bccd0871bd127..dd5a25dab52b070c35a0a63776e1d6e87bd1befa 100644 (file)
@@ -29,7 +29,7 @@
 const char test_title[] = "XSA-173 PoC";
 
 /* New L2 pagetable for the test to manipulate. */
-uint64_t nl2[PAE_L2_PT_ENTRIES] __aligned(PAGE_SIZE);
+uint64_t nl2[PAE_L2_PT_ENTRIES] __page_aligned_bss;
 
 static bool seen_fault;
 
index 93a706512d0977e7608783cf3d2c13e071fce358..894a229970775238cda91d4b0c3bd317dd6755d9 100644 (file)
@@ -97,8 +97,8 @@ void test_main(void)
 
     if ( IS_DEFINED(CONFIG_64BIT) )
     {
-        static intpte_t nl1t[L1_PT_ENTRIES] __aligned(PAGE_SIZE);
-        static intpte_t nl2t[L2_PT_ENTRIES] __aligned(PAGE_SIZE);
+        static intpte_t nl1t[L1_PT_ENTRIES] __page_aligned_bss;
+        static intpte_t nl2t[L2_PT_ENTRIES] __page_aligned_bss;
 
         /*
          * The manuals say we can't `iretq` to a compat mode code segment with
index 0fac31f9173ddf4ae37123d03de74d652586d8b3..a02059af6494184e405bf718dc49405827ba1708 100644 (file)
@@ -20,7 +20,7 @@
 
 const char test_title[] = "XSA-188 PoC";
 
-static uint8_t array_page[PAGE_SIZE] __aligned(PAGE_SIZE);
+static uint8_t array_page[PAGE_SIZE] __page_aligned_bss;
 
 void test_main(void)
 {
index fb90df5615c5c8eab550f0f2bda39c9869d0a3ab..945b50b1df5709314b2196b531ab150d870d0f8e 100644 (file)
@@ -30,9 +30,9 @@
 
 const char test_title[] = "XSA-195 PoC";
 
-static intpte_t nl3t[L3_PT_ENTRIES] __aligned(PAGE_SIZE);
-static intpte_t nl2t[L2_PT_ENTRIES] __aligned(PAGE_SIZE);
-static intpte_t nl1t[L1_PT_ENTRIES] __aligned(PAGE_SIZE);
+static intpte_t nl3t[L3_PT_ENTRIES] __page_aligned_bss;
+static intpte_t nl2t[L2_PT_ENTRIES] __page_aligned_bss;
+static intpte_t nl1t[L1_PT_ENTRIES] __page_aligned_bss;
 
 void test_main(void)
 {