Hi Feng,

This error was encountered on an AARCH64 ARM based platform, in a PEIM driver 
that was attempting to set a PCD.  After we figured out that the unaligned 
access was causing the exception, we searched in other projects, both X86 and 
ARM, and did not find any PEIMs that were attempting to set PCD values.  We 
assumed that our project was just one of the few that were trying to use this 
functionality.


As far as the tool needing to generate aligned pcd data... in the PcdPeim, the 
PeiPcdGetN functions (PeiPcdGet16, PeiPcdGet32, PeiPcdGet64) use the 
ReadUnalignedN functions on the returned pointers returned by the GetWorker 
functions. This leads me to believe that unaligned PCD values are allowed by 
the tool, and that the Set functions were never tested in the same way as the 
get functions.

Best Regards,
Aaron


-----Original Message-----
From: Tian, Feng [mailto:feng.t...@intel.com] 
Sent: Tuesday, January 06, 2015 8:35 PM
To: edk2-devel@lists.sourceforge.net; Aaron Pop
Cc: Tian, Feng
Subject: RE: [edk2] [PATCH] MdeModulePkg: PcdPeim: Unaligned PcdSet in PEI for 
architectures requiring alignment

Aaron,

Sorry for late response.

Could you let me know it's a real case or review result? If it's a real case, 
could you share us how to reproduce it?

In PCD_DATABASE_INIT of PcdDataBaseSignatureGuid.h, you can see below comments
    //
    // Padding is needed to keep necessary alignment
    //
It means build tool should generate aligned pcd data and make all data access 
work.

Please correct me if I misunderstand something.

Thanks
Feng

-----Original Message-----
From: Aaron Pop [mailto:aar...@ami.com] 
Sent: Tuesday, December 30, 2014 04:50
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [PATCH] MdeModulePkg: PcdPeim: Unaligned PcdSet in PEI for 
architectures requiring alignment

On architectures that require aligned reads/writes, the PCD PEIM can cause a 
misaligned access exception.  This stems from the PcdPeim's SetWorker not using 
the WriteUnalignedN functions from the BaseLib.  The attached patch file 
includes modifications to the PEIM that enforce unaligned access for calls to 
PcdSet.

Best Regards,
Aaron

The information contained in this message may be confidential and proprietary 
to American Megatrends, Inc.  This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited.  Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.

The information contained in this message may be confidential and proprietary 
to American Megatrends, Inc.  This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited.  Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to