Re: [edk2] PEI Core Debug Alignment Issue

Subject: Re: [edk2] PEI Core Debug Alignment Issue

From: "Kinney, Michael D" <michael.d.kinney@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2011-05-19 19:42:21

Andrew,

Do you mean changing Line 634 of MdePkg/Library/BasePrintLib/PrintLibInternal.c from:

          BasePrintLibSPrint (
            ValueBuffer,
            MAXIMUM_VALUE_CHARACTERS, 
            0,
            "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
            TmpGuid->Data1,
            TmpGuid->Data2,
            TmpGuid->Data3,
            TmpGuid->Data4[0],
            TmpGuid->Data4[1],
            TmpGuid->Data4[2],
            TmpGuid->Data4[3],
            TmpGuid->Data4[4],
            TmpGuid->Data4[5],
            TmpGuid->Data4[6],
            TmpGuid->Data4[7]
            );
To:
          BasePrintLibSPrint (
            ValueBuffer,
            MAXIMUM_VALUE_CHARACTERS, 
            0,
            "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
            ReadUnaligned32 (&(TmpGuid->Data1)),
            ReadUnaligned16 (&(TmpGuid->Data2)),
            ReadUnaligned16 (&(TmpGuid->Data3)),
            TmpGuid->Data4[0],
            TmpGuid->Data4[1],
            TmpGuid->Data4[2],
            TmpGuid->Data4[3],
            TmpGuid->Data4[4],
            TmpGuid->Data4[5],
            TmpGuid->Data4[6],
            TmpGuid->Data4[7]
            );

Mike

-----Original Message-----
From: Andrew Fish [mailto:afish@apple.com] 
Sent: Thursday, May 19, 2011 9:24 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] PEI Core Debug Alignment Issue

On May 19, 2011, at 7:53 AM, Cohen, Eugene wrote:

> The PeimDispatchReadiness function contains this debug statement:
> 
> DEBUG ((DEBUG_DISPATCH, "  PUSH GUID(%g) = %a\n", StackPtr->Operator, IsPpiInstalled (PeiServices, StackPtr) ? "TRUE" : "FALSE"));
> 
> this is supposed to print out a guid of a dependency.  I'm seeing that this guid is not aligned on a natural boundary, I'm guessing the depex is packed (?).  This causes an exception on systems that don't tolerate unaligned accesses because the guid printing function makes word accesses but the pointer is not aligned on a word boundary.  I think the code would need to copy the buffer into an aligned guid buffer first then make the call to print.

Or should we fix the print code to use the unaligned data access functions from the BaseLib?

> 
> This is only seen on systems if the DISPATCH level is active.
> 
> Eugene
> 
> 
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its 
> next-generation tools to help Windows* and Linux* C/C++ and Fortran 
> developers boost performance applications - including clusters. 
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel