diff options
author | Taylor Beebe <taylor.d.beebe@gmail.com> | 2023-11-03 08:29:44 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-11-27 18:55:18 +0000 |
commit | 3565ee6c29ffcb2d4d500e857bc3501b5247aeee (patch) | |
tree | 6e2af16220db7b5e3a8944294adb06ce89553d6e /MdeModulePkg/Include | |
parent | aa77dac3fb2c2861ee841809075b615359bf6352 (diff) | |
download | edk2-3565ee6c29ffcb2d4d500e857bc3501b5247aeee.tar.gz |
MdeModulePkg: Add Logic to Create/Delete Image Properties Records
Add logic to create and delete image properties records. Where
applicable, redirect existing code to use the new library.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r-- | MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h index e3f569ab03..5090a52153 100644 --- a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h +++ b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h @@ -192,4 +192,43 @@ DumpImageRecord ( IN LIST_ENTRY *ImageRecordList
);
+/**
+ Creates an IMAGE_PROPERTIES_RECORD from a loaded PE image. The PE/COFF header will be found
+ and parsed to determine the number of code segments and their base addresses and sizes.
+
+ @param[in] ImageBase Base of the PE image
+ @param[in] ImageSize Size of the PE image
+ @param[in] RequiredAlignment If non-NULL, the alignment specified in the PE/COFF header
+ will be compared against this value.
+ @param[out] ImageRecord On out, a populated image properties record
+
+ @retval EFI_INVALID_PARAMETER This function ImageBase or ImageRecord was NULL, or the
+ image located at ImageBase was not a valid PE/COFF image
+ @retval EFI_OUT_OF_RESOURCES Failure to Allocate()
+ @retval EFI_ABORTED The input Alignment was non-NULL and did not match the
+ alignment specified in the PE/COFF header
+ @retval EFI_SUCCESS The image properties record was successfully created
+**/
+EFI_STATUS
+EFIAPI
+CreateImagePropertiesRecord (
+ IN CONST VOID *ImageBase,
+ IN CONST UINT64 ImageSize,
+ IN CONST UINT32 *Alignment OPTIONAL,
+ OUT IMAGE_PROPERTIES_RECORD *ImageRecord
+ );
+
+/**
+ Deleted an image properties record. The function will also call
+ RemoveEntryList() on each code segment and the input ImageRecord before
+ freeing each pool.
+
+ @param[in] ImageRecord The IMAGE_PROPERTIES_RECORD to delete
+**/
+VOID
+EFIAPI
+DeleteImagePropertiesRecord (
+ IN IMAGE_PROPERTIES_RECORD *ImageRecord
+ );
+
#endif
|