limine-bootloader / limine

Modern, advanced, portable, multiprotocol bootloader and boot manager.
https://limine-bootloader.org
BSD 2-Clause "Simplified" License
1.8k stars 136 forks source link

Specify stack pointer alignment on entry #375

Closed adavis628 closed 2 months ago

adavis628 commented 2 months ago

Currently, the Limine boot protocol doesn't specify the alignment of the stack pointer on entry. On x86_64, the System V ABI requires it to be 16-byte aligned before calling a function. I don't know the required alignments for other architectures, but I'd assume they'd have similar requirements.

mintsuki commented 2 months ago

Hello,

As Limine follows the System V ABI, the stack is 16-aligned + 8 at entry (as the 8 are, as you said, required to hold the return address for the caller, which in Limine's case is set to 0, as per spec).

Likewise for other architectures.