@@ -224,7 +224,7 @@ impl BootInformation {
224
224
/// Search for the Memory map tag.
225
225
pub fn memory_map_tag ( & self ) -> Option < & MemoryMapTag > {
226
226
self . get_tag ( TagType :: Mmap )
227
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const MemoryMapTag ) } )
227
+ . map ( |tag| tag. cast_tag :: < MemoryMapTag > ( ) )
228
228
}
229
229
230
230
/// Get an iterator of all module tags.
@@ -235,13 +235,13 @@ impl BootInformation {
235
235
/// Search for the BootLoader name tag.
236
236
pub fn boot_loader_name_tag ( & self ) -> Option < & BootLoaderNameTag > {
237
237
self . get_tag ( TagType :: BootLoaderName )
238
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const BootLoaderNameTag ) } )
238
+ . map ( |tag| tag. cast_tag :: < BootLoaderNameTag > ( ) )
239
239
}
240
240
241
241
/// Search for the Command line tag.
242
242
pub fn command_line_tag ( & self ) -> Option < & CommandLineTag > {
243
243
self . get_tag ( TagType :: Cmdline )
244
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const CommandLineTag ) } )
244
+ . map ( |tag| tag. cast_tag :: < CommandLineTag > ( ) )
245
245
}
246
246
247
247
/// Search for the VBE framebuffer tag.
@@ -253,25 +253,25 @@ impl BootInformation {
253
253
/// Search for the EFI 32-bit SDT tag.
254
254
pub fn efi_sdt_32_tag ( & self ) -> Option < & EFISdt32 > {
255
255
self . get_tag ( TagType :: Efi32 )
256
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const EFISdt32 ) } )
256
+ . map ( |tag| tag. cast_tag :: < EFISdt32 > ( ) )
257
257
}
258
258
259
259
/// Search for the EFI 64-bit SDT tag.
260
260
pub fn efi_sdt_64_tag ( & self ) -> Option < & EFISdt64 > {
261
261
self . get_tag ( TagType :: Efi64 )
262
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const EFISdt64 ) } )
262
+ . map ( |tag| tag. cast_tag :: < EFISdt64 > ( ) )
263
263
}
264
264
265
265
/// Search for the (ACPI 1.0) RSDP tag.
266
266
pub fn rsdp_v1_tag ( & self ) -> Option < & RsdpV1Tag > {
267
267
self . get_tag ( TagType :: AcpiV1 )
268
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const RsdpV1Tag ) } )
268
+ . map ( |tag| tag. cast_tag :: < RsdpV1Tag > ( ) )
269
269
}
270
270
271
271
/// Search for the (ACPI 2.0 or later) RSDP tag.
272
272
pub fn rsdp_v2_tag ( & self ) -> Option < & RsdpV2Tag > {
273
273
self . get_tag ( TagType :: AcpiV2 )
274
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const RsdpV2Tag ) } )
274
+ . map ( |tag| tag. cast_tag :: < RsdpV2Tag > ( ) )
275
275
}
276
276
277
277
/// Search for the EFI Memory map tag.
@@ -282,32 +282,32 @@ impl BootInformation {
282
282
Some ( _tag) => None ,
283
283
None => self
284
284
. get_tag ( TagType :: EfiMmap )
285
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const EFIMemoryMapTag ) } ) ,
285
+ . map ( |tag| tag. cast_tag :: < EFIMemoryMapTag > ( ) ) ,
286
286
}
287
287
}
288
288
289
289
/// Search for the EFI 32-bit image handle pointer.
290
290
pub fn efi_32_ih ( & self ) -> Option < & EFIImageHandle32 > {
291
291
self . get_tag ( TagType :: Efi32Ih )
292
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const EFIImageHandle32 ) } )
292
+ . map ( |tag| tag. cast_tag :: < EFIImageHandle32 > ( ) )
293
293
}
294
294
295
295
/// Search for the EFI 64-bit image handle pointer.
296
296
pub fn efi_64_ih ( & self ) -> Option < & EFIImageHandle64 > {
297
297
self . get_tag ( TagType :: Efi64Ih )
298
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const EFIImageHandle64 ) } )
298
+ . map ( |tag| tag. cast_tag :: < EFIImageHandle64 > ( ) )
299
299
}
300
300
301
301
/// Search for the Image Load Base Physical Address.
302
302
pub fn load_base_addr ( & self ) -> Option < & ImageLoadPhysAddr > {
303
303
self . get_tag ( TagType :: LoadBaseAddr )
304
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const ImageLoadPhysAddr ) } )
304
+ . map ( |tag| tag. cast_tag :: < ImageLoadPhysAddr > ( ) )
305
305
}
306
306
307
307
/// Search for the VBE information tag.
308
308
pub fn vbe_info_tag ( & self ) -> Option < & ' static VBEInfoTag > {
309
309
self . get_tag ( TagType :: Vbe )
310
- . map ( |tag| unsafe { & * ( tag as * const Tag as * const VBEInfoTag ) } )
310
+ . map ( |tag| tag. cast_tag :: < VBEInfoTag > ( ) )
311
311
}
312
312
313
313
fn get ( & self ) -> & BootInformationInner {
0 commit comments