Skip to content

Commit

Permalink
asm: use proper page size alignment
Browse files Browse the repository at this point in the history
Stack should start at page boundary.
Use PAGE_SIZE macro where possible.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Oct 28, 2020
1 parent 97e7040 commit c060bc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion arch/x86/boot/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <asm-macros.h>
#include <page.h>
#include <processor.h>
#include <segment.h>

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/boot/pagetables.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit c060bc7

Please sign in to comment.