public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: heyi.guo <heyi.guo@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PrintLib] Question about ASSERT_UNICODE_BUFFER
Date: Fri, 1 Dec 2017 17:23:54 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5A7DC8E00@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <F745BF38-5416-4DD5-B5FC-146633C5F4B0@linaro.org>

Gary,

The correct solution is to align the Unicode string buffer before using those APIs.

The assert for unaligned Unicode string has been in place for over 10 years, and we have always
been able to address this type of issue by fixing the calling code.

Mike

From: heyi.guo [mailto:heyi.guo@linaro.org]
Sent: Thursday, November 30, 2017 10:58 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [PrintLib] Question about ASSERT_UNICODE_BUFFER

Hi folks,

I think platforms supported in EDK2 should enable unaligned data access, so a CHAR16 * pointer still works even if the pointer itself is not aligned by 2. Therefore, can we remove ASSERT_UNICODE_BUFFER statements in PrintLib for Unicode operations? If the platform doesn't support unaligned access, it can generate some kind of exception instead of software assert.

The background is that we are importing a 3rd party driver and it packs a unicode string buffer into a structure, and #pragma pack(1) is used around the definition of this structure. So the alignment of the string buffer depends on the address of the whole structure and the members before it; it happened to be not aligned and we got assert during system post.

Please let me know your comments.

Thanks,

Gary (Heyi Guo)

       reply	other threads:[~2017-12-01 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F745BF38-5416-4DD5-B5FC-146633C5F4B0@linaro.org>
2017-12-01 17:23 ` Kinney, Michael D [this message]
2017-12-04  1:24   ` [PrintLib] Question about ASSERT_UNICODE_BUFFER Heyi Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E92EE9817A31E24EB0585FDF735412F5A7DC8E00@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox