On Thu, 30 Mar 2023 at 16:45, Michael Kubacki
<mikub...@linux.microsoft.com> wrote:
>
> On 3/27/2023 7:01 AM, Ard Biesheuvel wrote:
> > When loading a PE/COFF image, capture the DLL characteristics fields of
> > the header into our image context structure so we can refer to them when
> > mapping the image.
> >
> > Signed-off-by: Ard Biesheuvel <a...@kernel.org>
> > ---
> >   MdePkg/Include/IndustryStandard/PeImage.h | 13 +++++-
> >   MdePkg/Include/Library/PeCoffLib.h        |  6 +++
> >   MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 46 +++++++++++++++-----
> >   3 files changed, 53 insertions(+), 12 deletions(-)
> >
> > diff --git a/MdePkg/Include/IndustryStandard/PeImage.h 
> > b/MdePkg/Include/IndustryStandard/PeImage.h
> > index dd4cc25483bc4bcf..a5b9b848ed391f98 100644
> > --- a/MdePkg/Include/IndustryStandard/PeImage.h
> > +++ b/MdePkg/Include/IndustryStandard/PeImage.h
> > @@ -625,7 +625,8 @@ typedef struct {
> >     UINT32    FileOffset;  ///< The file pointer to the debug data.
> >
> >   } EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
> >
> >
> >
> > -#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW  2    ///< The Visual C++ debug 
> > information.
> >
> > +#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW               2    ///< The Visual 
> > C++ debug information.
> >
> > +#define EFI_IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS  20
> >
> >
> >
> >   ///
> >
> >   /// Debug Data Structure defined in Microsoft C++.
> >
> > @@ -669,6 +670,16 @@ typedef struct {
> >     //
> >
> >   } EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY;
> >
> >
> >
> > +///
> >
> > +/// Extended DLL Characteristics
> >
> > +///
> >
> > +#define EFI_IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT          0x0001
> >
> > +#define EFI_IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT  0x0040
> >
> > +
> >
> > +typedef struct {
> >
> > +  UINT16    DllCharacteristicsEx;
> >
> > +} EFI_IMAGE_DEBUG_EX_DLLCHARACTERISTICS_ENTRY;
> >
> > +
> >
> >   ///
> >
> >   /// Resource format.
> >
> >   ///
> >
> > diff --git a/MdePkg/Include/Library/PeCoffLib.h 
> > b/MdePkg/Include/Library/PeCoffLib.h
> > index b45879453785c77d..d21c932076c072f6 100644
> > --- a/MdePkg/Include/Library/PeCoffLib.h
> > +++ b/MdePkg/Include/Library/PeCoffLib.h
> > @@ -171,6 +171,12 @@ typedef struct {
> >     ///
> >
> >     UINT16                      ImageType;
> >
> >     ///
> >
> > +  /// Set by PeCoffLoaderGetImageInfo() to the DLL flags stored in the 
> > PE/COFF header and
> >
> > +  /// in the DllCharacteristicsEx debug table.
> >
> > +  ///
> >
> > +  UINT16                      DllCharacteristics;
> >
> > +  UINT16                      DllCharacteristicsEx;
> >
> I know DllCharacteristics has a size of 2 in the spec, but the
> DllCharacteristicsEx is defined as 4 bytes. I will try to get a spec
> update to clarify this.
>

Thanks. I'll change this to 4 in the next respin.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102188): https://edk2.groups.io/g/devel/message/102188
Mute This Topic: https://groups.io/mt/97879303/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to