[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header
Re: [MULTIBOOT2 SPEC PATCH v3 4/4] multiboot2: fix example kernel header tag alignment
Wed, 13 May 2020 18:34:40 +0200
On Fri, May 08, 2020 at 06:50:49AM +0200, Hans Ulrich Niedermann wrote:
> Properly align all Multiboot2 header tags to 8 byte
> boundaries as per the Multiboot2 specification.
> Note that the assembler directive ".align 8" is machine
> dependent: On i386, it means "align to 8 byte boundary".
> On mips, it means that the lower 8 bits of address must
> be zero, i.e. ".align 8" aligns to a 256 byte boundary!
> Therefore, this changes boot_mips.S to use ".balign 8"
> where it had mistakenly used ".align 8" before.
> The boot_i386.S file keeps using ".align 8".
I would use ".balign 8" everywhere to avoid confusion.
> Note also that the Multiboot2 header termination tag
> (unfortunately unlabeled in the source) actually needs
> that extra alignment to an 8 byte boundary, as the
> preceding tag (framebuffer_tag_start) is 20 bytes long
> which is not a multiple of 8.
> You can add "-Wa,-adhlns=$(@:.o=.lst)" to kernel_CCASFLAGS
> to generate a listing file which shows the offsets of the
> labels in the boot_*.S files to verify the alignment issues.
> Note also that the "grub-file --is-x86-multiboot2" utility
> does not recognize the wrong alignment of the Multiboot2
> header tags, as it only considers the beginning of the
> Multiboot2 header and completely ignores the Multiboot2
> header tags.
Please also mention here that you are additionally fixing
some formatting errors.