multiboot2_header/
entry_efi_32.rs1use crate::{HeaderTagFlag, HeaderTagHeader, HeaderTagType};
2use core::fmt;
3use core::fmt::{Debug, Formatter};
4use multiboot2_common::{MaybeDynSized, Tag};
5
6#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
15#[repr(C, align(8))]
16pub struct EntryEfi32HeaderTag {
17 header: HeaderTagHeader,
18 entry_addr: u32,
19}
20
21impl EntryEfi32HeaderTag {
22 #[must_use]
24 pub const fn new(flags: HeaderTagFlag, entry_addr: u32) -> Self {
25 let header = HeaderTagHeader::new(
26 HeaderTagType::EntryAddressEFI32,
27 flags,
28 Self::BASE_SIZE as u32,
29 );
30 Self { header, entry_addr }
31 }
32
33 #[must_use]
35 pub const fn typ(&self) -> HeaderTagType {
36 self.header.typ()
37 }
38
39 #[must_use]
41 pub const fn flags(&self) -> HeaderTagFlag {
42 self.header.flags()
43 }
44
45 #[must_use]
47 pub const fn size(&self) -> u32 {
48 self.header.size()
49 }
50
51 #[must_use]
53 pub const fn entry_addr(&self) -> u32 {
54 self.entry_addr
55 }
56}
57
58impl Debug for EntryEfi32HeaderTag {
59 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
60 f.debug_struct("EntryEfi32HeaderTag")
61 .field("type", &self.typ())
62 .field("flags", &self.flags())
63 .field("size", &self.size())
64 .field("entry_addr", &self.entry_addr)
65 .finish()
66 }
67}
68
69impl MaybeDynSized for EntryEfi32HeaderTag {
70 type Header = HeaderTagHeader;
71
72 const BASE_SIZE: usize = size_of::<HeaderTagHeader>() + size_of::<u32>();
73}
74
75impl Tag for EntryEfi32HeaderTag {
76 type IDType = HeaderTagType;
77 const ID: HeaderTagType = HeaderTagType::EntryAddressEFI32;
78}