From 1e22a668f2d9ff58597ce08782fcea6896c07c2d Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 21 Sep 2023 16:33:00 +0200 Subject: [PATCH] multiboot2: move EFIBootServicesNotExitedTag to efi module This change is not breaking as this path change is publicly not visible. --- multiboot2/src/efi.rs | 31 +++++++++++++++++++++++++++++++ multiboot2/src/lib.rs | 8 +++++--- multiboot2/src/memory_map.rs | 31 ------------------------------- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/multiboot2/src/efi.rs b/multiboot2/src/efi.rs index c5f38b77..99972ff1 100644 --- a/multiboot2/src/efi.rs +++ b/multiboot2/src/efi.rs @@ -131,6 +131,37 @@ impl TagTrait for EFIImageHandle64Tag { fn dst_size(_base_tag: &Tag) {} } +/// EFI ExitBootServices was not called tag. +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[repr(C)] +pub struct EFIBootServicesNotExitedTag { + typ: TagTypeId, + size: u32, +} + +impl EFIBootServicesNotExitedTag { + #[cfg(feature = "builder")] + pub fn new() -> Self { + Self::default() + } +} + +#[cfg(feature = "builder")] +impl Default for EFIBootServicesNotExitedTag { + fn default() -> Self { + Self { + typ: TagType::EfiBs.into(), + size: core::mem::size_of::().try_into().unwrap(), + } + } +} + +impl TagTrait for EFIBootServicesNotExitedTag { + const ID: TagType = TagType::EfiBs; + + fn dst_size(_base_tag: &Tag) {} +} + #[cfg(all(test, feature = "builder"))] mod tests { use super::{EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag}; diff --git a/multiboot2/src/lib.rs b/multiboot2/src/lib.rs index b856ba1a..9104dcaf 100644 --- a/multiboot2/src/lib.rs +++ b/multiboot2/src/lib.rs @@ -67,7 +67,9 @@ mod vbe_info; pub use boot_loader_name::BootLoaderNameTag; pub use command_line::CommandLineTag; -pub use efi::{EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag}; +pub use efi::{ + EFIBootServicesNotExitedTag, EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag, +}; pub use elf_sections::{ ElfSection, ElfSectionFlags, ElfSectionIter, ElfSectionType, ElfSectionsTag, }; @@ -75,8 +77,8 @@ pub use end::EndTag; pub use framebuffer::{FramebufferColor, FramebufferField, FramebufferTag, FramebufferType}; pub use image_load_addr::ImageLoadPhysAddrTag; pub use memory_map::{ - BasicMemoryInfoTag, EFIBootServicesNotExitedTag, EFIMemoryAreaType, EFIMemoryDesc, - EFIMemoryMapTag, MemoryArea, MemoryAreaType, MemoryAreaTypeId, MemoryMapTag, + BasicMemoryInfoTag, EFIMemoryAreaType, EFIMemoryDesc, EFIMemoryMapTag, MemoryArea, + MemoryAreaType, MemoryAreaTypeId, MemoryMapTag, }; pub use module::{ModuleIter, ModuleTag}; pub use ptr_meta::Pointee; diff --git a/multiboot2/src/memory_map.rs b/multiboot2/src/memory_map.rs index 147b7e7d..a94df130 100644 --- a/multiboot2/src/memory_map.rs +++ b/multiboot2/src/memory_map.rs @@ -334,37 +334,6 @@ impl TagTrait for EFIMemoryMapTag { } } -/// EFI ExitBootServices was not called tag. -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[repr(C)] -pub struct EFIBootServicesNotExitedTag { - typ: TagTypeId, - size: u32, -} - -impl EFIBootServicesNotExitedTag { - #[cfg(feature = "builder")] - pub fn new() -> Self { - Self::default() - } -} - -#[cfg(feature = "builder")] -impl Default for EFIBootServicesNotExitedTag { - fn default() -> Self { - Self { - typ: TagType::EfiBs.into(), - size: mem::size_of::().try_into().unwrap(), - } - } -} - -impl TagTrait for EFIBootServicesNotExitedTag { - const ID: TagType = TagType::EfiBs; - - fn dst_size(_base_tag: &Tag) {} -} - /// An iterator over ALL EFI memory areas. #[derive(Clone, Debug)] pub struct EFIMemoryAreaIter<'a> {