From c060bc7c44829a85f4ebbcb016890a87619f8a69 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Mon, 26 Oct 2020 15:03:55 +0100 Subject: [PATCH] asm: use proper page size alignment Stack should start at page boundary. Use PAGE_SIZE macro where possible. Signed-off-by: Pawel Wieczorkiewicz --- arch/x86/boot/head.S | 5 ++++- arch/x86/boot/pagetables.S | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/boot/head.S b/arch/x86/boot/head.S index 8c435cdf..f3d180b4 100644 --- a/arch/x86/boot/head.S +++ b/arch/x86/boot/head.S @@ -23,6 +23,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include @@ -95,15 +96,17 @@ GLOBAL(_start) ud2 -SECTION(.bss.init, "aw", 16) +SECTION(.bss.init, "aw", PAGE_SIZE) _boot_stack: .skip BOOT_STACK_SIZE GLOBAL(_boot_stack_top) +.align PAGE_SIZE _boot_stack_ist: .skip BOOT_STACK_SIZE GLOBAL(_boot_stack_ist_top) +.align PAGE_SIZE _boot_stack_df: .skip BOOT_STACK_SIZE GLOBAL(_boot_stack_df_top) diff --git a/arch/x86/boot/pagetables.S b/arch/x86/boot/pagetables.S index b026e885..4eb6d3bb 100644 --- a/arch/x86/boot/pagetables.S +++ b/arch/x86/boot/pagetables.S @@ -29,7 +29,7 @@ #define _PADDR(table, shift) (((. - (table)) / PTE_SIZE) << (shift)) /* Initial identity map page tables */ -SECTION(.data.init, "aw", 0x1000) +SECTION(.data.init, "aw", PAGE_SIZE) GLOBAL(l1_pt_entries) .rept L1_PT_ENTRIES .long _PADDR(l1_pt_entries, L1_PT_SHIFT) + L1_PROT, 0 @@ -42,7 +42,7 @@ GLOBAL(l2_pt_entries) END_OBJECT(l2_pt_entries) #if defined(__i386__) -.align 0x1000 +.align PAGE_SIZE #endif GLOBAL(l3_pt_entries) .long l2_pt_entries + L3_PROT, 0 @@ -55,7 +55,7 @@ GLOBAL(l3_pt_entries) END_OBJECT(l3_pt_entries) #if defined(__x86_64__) -.align 0x1000 +.align PAGE_SIZE GLOBAL(l4_pt_entries) .long l3_pt_entries + L4_PROT, 0