1 use core::{fmt, mem}; 2 3 use uefi_raw::Guid; 4 5 /// 由DragonStub设置的,用于描述内核被放置在的地址的GUID 6 pub static DRAGONSTUB_EFI_PAYLOAD_EFI_GUID: Guid = Guid::new( 7 unsafe { mem::transmute_copy(&0xddf1d47cu32) }, 8 unsafe { mem::transmute_copy(&0x102cu32) }, 9 unsafe { mem::transmute_copy(&0xaaf9u32) }, 10 0xce, 11 0x34, 12 [0xbc, 0xef, 0x98, 0x12, 0x00, 0x31], 13 ); 14 15 pub static EFI_MEMORY_ATTRIBUTES_TABLE_GUID: Guid = Guid::new( 16 unsafe { mem::transmute_copy(&0xdcfa911du32) }, 17 unsafe { mem::transmute_copy(&0x26ebu32) }, 18 unsafe { mem::transmute_copy(&0x469fu32) }, 19 0xa2, 20 0x20, 21 [0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20], 22 ); 23 24 pub static EFI_MEMRESERVE_TABLE_GUID: Guid = Guid::new( 25 unsafe { mem::transmute_copy(&0x888eb0c6u32) }, 26 unsafe { mem::transmute_copy(&0x8edeu32) }, 27 unsafe { mem::transmute_copy(&0x4ff5u32) }, 28 0xa8, 29 0xf0, 30 [0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2], 31 ); 32 /// 表示内核被加载到的地址的信息。 33 /// 34 /// 对应 `DRAGONSTUB_EFI_PAYLOAD_EFI_GUID` 35 #[derive(Clone, Copy)] 36 #[repr(C)] 37 pub struct DragonStubPayloadEFI { 38 /// 内核文件被加载到的物理地址 39 pub paddr: u64, 40 41 /// 占用的空间的大小 42 pub size: u64, 43 } 44 45 impl fmt::Debug for DragonStubPayloadEFI { 46 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 47 f.debug_struct("DragonStubPayloadEFI") 48 .field("paddr", &format_args!("0x{:x}", self.paddr)) 49 .field("size", &self.size) 50 .finish() 51 } 52 } 53