From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::22d; helo=mail-pf0-x22d.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com [IPv6:2607:f8b0:400e:c00::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 029B1220EE069 for ; Sun, 3 Dec 2017 17:23:16 -0800 (PST) Received: by mail-pf0-x22d.google.com with SMTP id n6so7334732pfa.4 for ; Sun, 03 Dec 2017 17:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=BWTPAjE744iqnoAxUpZ7WByLi2JlugvnCpvP/AJt7ZU=; b=FUfpOMYWvVjdnGErqkBW+gdyy+IS7JJXrxXyms4Qr3ip3uhk1JcuB/jc03ZsHN0RtT Pc5+bwI1rWg87XG4UgrRU6FypYVua43WTOIaF0VffgERQsp3CX9pwq4Eg5gkD/k+pG5N bFrhr1/KTRBdthVegfgVoUsYPwYVFuEWovucA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=BWTPAjE744iqnoAxUpZ7WByLi2JlugvnCpvP/AJt7ZU=; b=lQ3Ij7T3yWPfiLJkaly4vovMKPmBYSmsLewU+j31H0hXr4khO6LmcZPUK60/x/6sNz 9/KVbFpxYzoauN5KSNANSFCmFtHrFH6kD+NnsaYSHKiy5MSnIJVODJzXQyxG7+75e5qH eXANP1qs4p8BDfJ6xNLKmn9lhaF8FpArWpGbyazzFr2qE4M+BxkFXSvWSg9UbEBU6Htv HeHVfQR8tWsvWEpcwteANUsyrOXl9kTqrF2EzYHhpByurX3f0wXPX+RUsP0gg87oREy+ t7GJrIsAk42wdCVDwb0M+te2uHitoDtNaNDsYTuww1oqx8PDu3ez+e86TbeVnAzxvEUy adjw== X-Gm-Message-State: AJaThX7hNBH+jSv9tmwT39OYcboTO/AaFTVHZpFk/tJfQinfVMBmxGkS klhgm9Tr1uVld/sYzNiLc2Sxfw== X-Google-Smtp-Source: AGs4zMbKN3mkT5jy9j43YnBl96oqrs0D4CYHkocbOx2ga5y1NBIbqxSCQwychuWylEYHuv3p7yiOhg== X-Received: by 10.98.18.157 with SMTP id 29mr17736496pfs.84.1512350865520; Sun, 03 Dec 2017 17:27:45 -0800 (PST) Received: from [10.105.3.162] ([104.237.91.54]) by smtp.gmail.com with ESMTPSA id t14sm16650918pgr.37.2017.12.03.17.27.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Dec 2017 17:27:44 -0800 (PST) To: "Kinney, Michael D" , "edk2-devel@lists.01.org" Cc: "Gao, Liming" References: From: Heyi Guo Message-ID: <484b43c1-534a-cb81-ae71-328d95e28dcd@linaro.org> Date: Mon, 4 Dec 2017 09:24:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: [PrintLib] Question about ASSERT_UNICODE_BUFFER X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 01:23:17 -0000 Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Thanks for your confirmation. Regards, Gary (Heyi Guo) 在 12/2/2017 1:23 AM, Kinney, Michael D 写道: > > 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 ; Kinney, Michael D > > *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) >