1*92849878SLoGin use core::{fmt, mem}; 2*92849878SLoGin 3*92849878SLoGin use uefi_raw::Guid; 4*92849878SLoGin 5*92849878SLoGin /// 由DragonStub设置的,用于描述内核被放置在的地址的GUID 6*92849878SLoGin pub static DRAGONSTUB_EFI_PAYLOAD_EFI_GUID: Guid = Guid::new( 7*92849878SLoGin unsafe { mem::transmute_copy(&0xddf1d47cu32) }, 8*92849878SLoGin unsafe { mem::transmute_copy(&0x102cu32) }, 9*92849878SLoGin unsafe { mem::transmute_copy(&0xaaf9u32) }, 10*92849878SLoGin 0xce, 11*92849878SLoGin 0x34, 12*92849878SLoGin [0xbc, 0xef, 0x98, 0x12, 0x00, 0x31], 13*92849878SLoGin ); 14*92849878SLoGin 15*92849878SLoGin /// 表示内核被加载到的地址的信息。 16*92849878SLoGin /// 17*92849878SLoGin /// 对应 `DRAGONSTUB_EFI_PAYLOAD_EFI_GUID` 18*92849878SLoGin #[derive(Clone, Copy)] 19*92849878SLoGin #[repr(C)] 20*92849878SLoGin pub struct DragonStubPayloadEFI { 21*92849878SLoGin /// 内核文件被加载到的物理地址 22*92849878SLoGin pub paddr: u64, 23*92849878SLoGin 24*92849878SLoGin /// 占用的空间的大小 25*92849878SLoGin pub size: u64, 26*92849878SLoGin } 27*92849878SLoGin 28*92849878SLoGin impl fmt::Debug for DragonStubPayloadEFI { 29*92849878SLoGin fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 30*92849878SLoGin f.debug_struct("DragonStubPayloadEFI") 31*92849878SLoGin .field("paddr", &format_args!("0x{:x}", self.paddr)) 32*92849878SLoGin .field("size", &self.size) 33*92849878SLoGin .finish() 34*92849878SLoGin } 35*92849878SLoGin } 36