@@ -101,26 +101,6 @@ pub mod builder;
101101/// that the Rust compiler output changes `eax` before you can access it.
102102pub const MAGIC : u32 = 0x36d76289 ;
103103
104- /// # Safety
105- /// Deprecated. Please use BootInformation::load() instead.
106- #[ deprecated = "Please use BootInformation::load() instead." ]
107- pub unsafe fn load < ' a > ( address : usize ) -> Result < BootInformation < ' a > , MbiLoadError > {
108- let ptr = address as * const BootInformationHeader ;
109- BootInformation :: load ( ptr)
110- }
111-
112- /// # Safety
113- /// Deprecated. Please use BootInformation::load() instead.
114- #[ deprecated = "Please use BootInformation::load() instead." ]
115- pub unsafe fn load_with_offset < ' a > (
116- address : usize ,
117- offset : usize ,
118- ) -> Result < BootInformation < ' a > , MbiLoadError > {
119- let ptr = address as * const u8 ;
120- let ptr = ptr. add ( offset) ;
121- BootInformation :: load ( ptr. cast ( ) )
122- }
123-
124104/// Error type that describes errors while loading/parsing a multiboot2 information structure
125105/// from a given address.
126106#[ derive( Display , Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
@@ -262,7 +242,9 @@ impl<'a> BootInformation<'a> {
262242 /// This is the same as doing:
263243 ///
264244 /// ```rust,no_run
265- /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
245+ /// # use multiboot2::{BootInformation, BootInformationHeader};
246+ /// # let ptr = 0xdeadbeef as *const BootInformationHeader;
247+ /// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
266248 /// let end_addr = boot_info.start_address() + boot_info.total_size();
267249 /// ```
268250 pub fn end_address ( & self ) -> usize {
@@ -285,7 +267,9 @@ impl<'a> BootInformation<'a> {
285267 /// # Examples
286268 ///
287269 /// ```rust,no_run
288- /// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
270+ /// # use multiboot2::{BootInformation, BootInformationHeader};
271+ /// # let ptr = 0xdeadbeef as *const BootInformationHeader;
272+ /// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
289273 /// if let Some(sections) = boot_info.elf_sections() {
290274 /// let mut total = 0;
291275 /// for section in sections {
@@ -414,7 +398,7 @@ impl<'a> BootInformation<'a> {
414398 ///
415399 /// ```no_run
416400 /// use std::str::Utf8Error;
417- /// use multiboot2::{Tag, TagTrait, TagType, TagTypeId};
401+ /// use multiboot2::{BootInformation, BootInformationHeader, Tag, TagTrait, TagType, TagTypeId};
418402 ///
419403 /// #[repr(C)]
420404 /// #[derive(multiboot2::Pointee)] // Only needed for DSTs.
@@ -442,8 +426,8 @@ impl<'a> BootInformation<'a> {
442426 /// Tag::get_dst_str_slice(&self.name)
443427 /// }
444428 /// }
445- ///
446- /// let mbi = unsafe { multiboot2 ::load(0xdeadbeef ).unwrap() };
429+ /// let mbi_ptr = 0xdeadbeef as *const BootInformationHeader;
430+ /// let mbi = unsafe { BootInformation ::load(mbi_ptr ).unwrap() };
447431 ///
448432 /// let tag = mbi
449433 /// .get_tag::<CustomTag>()
@@ -1258,15 +1242,6 @@ mod tests {
12581242 let bi = bi. unwrap ( ) ;
12591243 test_grub2_boot_info ( & bi, addr, string_addr, & bytes. 0 , & string_bytes. 0 ) ;
12601244
1261- let bi = unsafe { load_with_offset ( addr, 0 ) } ;
1262- let bi = bi. unwrap ( ) ;
1263- test_grub2_boot_info ( & bi, addr, string_addr, & bytes. 0 , & string_bytes. 0 ) ;
1264-
1265- let offset = 8usize ;
1266- let bi = unsafe { load_with_offset ( addr - offset, offset) } ;
1267- let bi = bi. unwrap ( ) ;
1268- test_grub2_boot_info ( & bi, addr, string_addr, & bytes. 0 , & string_bytes. 0 ) ;
1269-
12701245 // Check that the MBI's debug output can be printed without SEGFAULT.
12711246 // If this works, it is a good indicator than transitively a lot of
12721247 // stuff works.
0 commit comments