Skip to content

Commit ab6bb32

Browse files
committed
tree-wide: remove align(8) for tags
This breaks the sizeof() property for many tags that I verify. Furthermore, the builder structs already take care of any alignments when they construct the MBI/MB header.
1 parent d54cddc commit ab6bb32

19 files changed

+35
-43
lines changed

multiboot2-header/src/address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use core::mem::size_of;
66
/// other format. Required for legacy boot (BIOS).
77
/// Determines load addresses.
88
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
9-
#[repr(C, align(8))]
9+
#[repr(C)]
1010
pub struct AddressHeaderTag {
1111
typ: HeaderTagType,
1212
flags: HeaderTagFlag,

multiboot2-header/src/end.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::mem::size_of;
33

44
/// Terminates a list of optional tags in a Multiboot2 header.
55
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
6-
#[repr(C, align(8))]
6+
#[repr(C)]
77
pub struct EndHeaderTag {
88
// u16 value
99
typ: HeaderTagType,

multiboot2-header/src/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl core::error::Error for LoadError {}
227227
/// The "basic" Multiboot2 header. This means only the properties, that are known during
228228
/// compile time. All other information are derived during runtime from the size property.
229229
#[derive(Copy, Clone, PartialEq, Eq)]
230-
#[repr(C, align(8))]
230+
#[repr(C)]
231231
pub struct Multiboot2BasicHeader {
232232
/// Must be the value of [`MULTIBOOT2_HEADER_MAGIC`].
233233
header_magic: u32,

multiboot2-header/src/module_align.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::mem::size_of;
33

44
/// If this tag is present, provided boot modules must be page aligned.
55
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
6-
#[repr(C, align(8))]
6+
#[repr(C)]
77
pub struct ModuleAlignHeaderTag {
88
typ: HeaderTagType,
99
flags: HeaderTagFlag,

multiboot2-header/src/relocatable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub enum RelocatableHeaderTagPreference {
2020

2121
/// This tag indicates that the image is relocatable.
2222
#[derive(Copy, Clone, PartialEq, Eq)]
23-
#[repr(C, align(8))]
23+
#[repr(C)]
2424
pub struct RelocatableHeaderTag {
2525
typ: HeaderTagType,
2626
flags: HeaderTagFlag,

multiboot2-header/src/tags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum HeaderTagFlag {
6464
/// that depend on the `typ` and the `size` field. All tags share the same beginning of the
6565
/// struct.
6666
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
67-
#[repr(C, align(8))]
67+
#[repr(C)]
6868
pub struct HeaderTag {
6969
// u16 value
7070
typ: HeaderTagType,

multiboot2-header/src/uefi_bs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::mem::size_of;
44
/// This tag indicates that payload supports starting without terminating UEFI boot services.
55
/// Or in other words: The payload wants to use UEFI boot services.
66
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
7-
#[repr(C, align(8))]
7+
#[repr(C)]
88
pub struct EfiBootServiceHeaderTag {
99
typ: HeaderTagType,
1010
flags: HeaderTagFlag,

multiboot2/src/boot_loader_name.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ use {
1212
const METADATA_SIZE: usize = size_of::<TagTypeId>() + size_of::<u32>();
1313

1414
/// The bootloader name tag.
15-
#[derive(ptr_meta::Pointee)]
16-
#[derive(PartialEq, Eq)]
17-
#[repr(C, align(8))]
15+
#[derive(ptr_meta::Pointee, PartialEq, Eq)]
16+
#[repr(C)]
1817
pub struct BootLoaderNameTag {
1918
typ: TagTypeId,
2019
size: u32,

multiboot2/src/command_line.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ pub(crate) const METADATA_SIZE: usize = mem::size_of::<TagTypeId>() + mem::size_
1818
///
1919
/// The string is a normal C-style UTF-8 zero-terminated string that can be
2020
/// obtained via the `command_line` method.
21-
#[derive(ptr_meta::Pointee)]
22-
#[derive(PartialEq, Eq)]
23-
#[repr(C, align(8))]
21+
#[derive(ptr_meta::Pointee, PartialEq, Eq)]
22+
#[repr(C)]
2423
pub struct CommandLineTag {
2524
typ: TagTypeId,
2625
size: u32,

multiboot2/src/efi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::builder::traits::StructAsBytes;
1010

1111
/// EFI system table in 32 bit mode
1212
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
13-
#[repr(C, align(8))]
13+
#[repr(C)]
1414
pub struct EFISdt32 {
1515
typ: TagTypeId,
1616
size: u32,
@@ -42,7 +42,7 @@ impl StructAsBytes for EFISdt32 {
4242

4343
/// EFI system table in 64 bit mode
4444
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
45-
#[repr(C, align(8))]
45+
#[repr(C)]
4646
pub struct EFISdt64 {
4747
typ: TagTypeId,
4848
size: u32,
@@ -74,7 +74,7 @@ impl StructAsBytes for EFISdt64 {
7474

7575
/// Contains pointer to boot loader image handle.
7676
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
77-
#[repr(C, align(8))]
77+
#[repr(C)]
7878
pub struct EFIImageHandle32 {
7979
typ: TagTypeId,
8080
size: u32,
@@ -106,7 +106,7 @@ impl StructAsBytes for EFIImageHandle32 {
106106

107107
/// Contains pointer to boot loader image handle.
108108
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
109-
#[repr(C, align(8))]
109+
#[repr(C)]
110110
pub struct EFIImageHandle64 {
111111
typ: TagTypeId,
112112
size: u32,

0 commit comments

Comments
 (0)