Mike -

Why is the library enforcing this? An ASSERT is used for a critical runtime 
error where a function cannot proceed. This condition does not fall into this 
category on any platform that I am aware of (although there might be a speed 
penalty).

Tim


From: Kinney, Michael D [mailto:[email protected]]
Sent: Wednesday, February 13, 2013 9:37 AM
To: [email protected]
Subject: Re: [edk2] How to align auto variables?

Sathya,

Those ASSERT() statements in APIs that operate in Unicode strings with a 
character type of CHAR16.

Is your string declared as a CHAR16 array?  If it is, then the compiler should 
align in 16-bot boundary automatically.  The one exception is an CHAR16 array 
in a packed structure.  If you are using a packed structure, then you need to 
order the fields or add padding fields as required to force proper alignment of 
individual fields.

If you are using pointer math to compute a CHAR16 * into a buffer, then you are 
responsible for alignment if the buffer data is not aligned.  You may need to 
copy contents of the buffer to a different buffer that is aligned.

Best regards,

Mike

From: Prakash, Sathya [mailto:[email protected]]
Sent: Wednesday, February 13, 2013 9:19 AM
To: [email protected]<mailto:[email protected]>
Subject: [edk2] How to align auto variables?


I am able to compile my code successfully with UDK but when I run my code I see 
lot ASSERTS similar to ASSERT (((UINTN) String & BIT0) == 0);


I have used a static library in my code which is compiled in EDK1.6 (I need to 
port that to UDK but for now I am keeping this way to do some basic testing)


I would like to know how to tell the compiler to align the char array allocated 
in string to be aligned to avoid the ASSERT?  Do I need to use 
__declspec(align(#)) across all the variable definitions, can I pass it once as 
a compile flag?

Thanks
Sathya
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to