* grub-core/kern/x86_64/efi/startup.S (_start): Align the stack to a

16-byte boundary, as required by the x86-64 ABI, before calling
	grub_main.  In some cases, GCC emits code that assumes this
	alignment, which crashes if not aligned.  The EFI firmware is also
	entitled to assume that stack alignment without checking.
This commit is contained in:
Josh Triplett 2013-11-19 14:31:40 +01:00 committed by Vladimir Serbinenko
parent d53f4900d7
commit 7960d3e182
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2013-11-19 Josh Triplett <josh@joshtriplett.org>
* grub-core/kern/x86_64/efi/startup.S (_start): Align the stack to a
16-byte boundary, as required by the x86-64 ABI, before calling
grub_main. In some cases, GCC emits code that assumes this
alignment, which crashes if not aligned. The EFI firmware is also
entitled to assume that stack alignment without checking.
2013-11-18 Josh Triplett <josh@joshtriplett.org> 2013-11-18 Josh Triplett <josh@joshtriplett.org>
* grub-core/mmap/efi/mmap.c (grub_mmap_register): Round up/down to * grub-core/mmap/efi/mmap.c (grub_mmap_register): Round up/down to

View file

@ -30,6 +30,6 @@ _start:
movq %rcx, EXT_C(grub_efi_image_handle)(%rip) movq %rcx, EXT_C(grub_efi_image_handle)(%rip)
movq %rdx, EXT_C(grub_efi_system_table)(%rip) movq %rdx, EXT_C(grub_efi_system_table)(%rip)
andq $~0xf, %rsp
call EXT_C(grub_main) call EXT_C(grub_main)
ret /* Doesn't return. */