Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve usage of repr(packed) #68

Merged
merged 5 commits into from Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct FramebufferField {

/// A framebuffer color descriptor in the palette.
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(C, packed)]
#[repr(C, packed)] // only repr(C) would add unwanted padding at the end
pub struct FramebufferColor {
/// The Red component of the color.
pub red: u8,
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ pub struct BootInformation {
offset: usize,
}

#[repr(C, packed)]
#[derive(Clone, Copy)]
#[repr(C)]
struct BootInformationInner {
total_size: u32,
_reserved: u32,
Expand Down
2 changes: 1 addition & 1 deletion src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use header::{Tag, TagIter};
/// This tag indicates to the kernel what boot module was loaded along with
/// the kernel image, and where it can be found.
#[derive(Clone, Copy, Debug)]
#[repr(C, packed)]
#[repr(C, packed)] // only repr(C) would add unwanted padding near name_byte.
pub struct ModuleTag {
typ: u32,
size: u32,
Expand Down
4 changes: 2 additions & 2 deletions src/rsdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const RSDPV1_LENGTH: usize = 20;

/// EFI system table in 32 bit mode
#[derive(Clone, Copy, Debug)]
#[repr(C, packed)]
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
pub struct EFISdt32 {
typ: u32,
size: u32,
Expand All @@ -29,7 +29,7 @@ impl EFISdt32 {

/// EFI system table in 64 bit mode
#[derive(Clone, Copy, Debug)]
#[repr(C, packed)]
#[repr(C)]
pub struct EFISdt64 {
typ: u32,
size: u32,
Expand Down