diff options
author | Slendi <slendi@socopon.com> | 2023-09-28 11:31:39 +0300 |
---|---|---|
committer | Slendi <slendi@socopon.com> | 2023-09-28 11:31:39 +0300 |
commit | dfb1a30d16f3ca38bdab1abaf44339a1a0e92194 (patch) | |
tree | a1afba00f2e0b83c0e8448f933bdc979a1d86f9c | |
parent | a1d043c28b11654535d9f2f4523197e0d8ff461a (diff) |
Add support for loaded image protocol.
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r-- | efi_loaded_image.odin | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/efi_loaded_image.odin b/efi_loaded_image.odin new file mode 100644 index 0000000..b074e58 --- /dev/null +++ b/efi_loaded_image.odin @@ -0,0 +1,74 @@ +package main + +EFI_LOADED_IMAGE_PROTOCOL_GUID: GUID : { + 0x5B1B31A1, + 0x9562, + 0x11d2, + {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}, +} +EFI_LOADED_IMAGE_PROTOCOL_REVISION :: 0x1000 + +// Unloads an image from memory. +// +// Inputs: +// - image_handle: The handle to the image to unload. Type EFI_HANDLE Driver +// Model Boot Services +EfiImageUnload :: proc "c" (image_handle: EfiHandle) + +// Can be used on any image handle to obtain information about the loaded +// image. +EfiLoadedImageProtocol :: struct { + // Defines the revision of the EFI_LOADED_IMAGE_PROTOCOL structure. All + // future revisions will be backward compatible to the current revision. + revision: u32, + // Parent image’s image handle. NULL if the image is loaded directly from the + // firmware’s boot manager. Type EFI_HANDLE is defined in Services – Boot + // Services. + parent_handle: EfiHandle, + // The image’s EFI system table pointer. Type EFI_SYSTEM_TABLE defined in EFI + // System Table. + system_table: ^EfiSystemTable, + + // Source location of the image + // + // The device handle that the EFI Image was loaded from. Type EFI_HANDLE is + // defined in Services – Boot Services. + device_handle: EfiHandle, + // A pointer to the file path portion specific to DeviceHandle that the EFI + // Image was loaded from. EFI_DEVICE_PATH_PROTOCOL is defined in EFI Device + // Path Protocol . + file_path: ^EfiDevicePathProtocol, + // Reserved. DO NOT USE. + reserved: rawptr, + + // Image’s load options + // + // The size in bytes of LoadOptions. + load_options_size: u32, + // A pointer to the image’s binary load options. See the OptionalData + // parameter in the Load Options section of the Boot Manager chapter for + // information on the source of the LoadOptions data. + load_options: rawptr, + + // Location where image was loaded + // + // The base address at which the image was loaded. + image_base: rawptr, + // The size in bytes of the loaded image. + image_size: u64, + // The memory type that the code sections were loaded as. Type + // EFI_MEMORY_TYPE is defined in Services – Boot Services. + image_code_type: EfiMemoryType, + // The memory type that the data sections were loaded as. Type + // EFI_MEMORY_TYPE is defined in in Services – Boot Services. + image_data_type: EfiMemoryType, + // Function that unloads the image + unload: EfiImageUnload, +} + +EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID: GUID : { + 0xbc62157e, + 0x3e33, + 0x4fec, + {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf}, +} |