From nobody Sun Dec 29 01:44:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1492483022380235.8321406813693; Mon, 17 Apr 2017 19:37:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6DD8821954061; Mon, 17 Apr 2017 19:37:00 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6C7B721A18AA9 for ; Mon, 17 Apr 2017 19:36:57 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 17 Apr 2017 19:36:57 -0700 Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.13]) by orsmga002.jf.intel.com with ESMTP; 17 Apr 2017 19:36:56 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,217,1488873600"; d="scan'208";a="75386368" From: Hao Wu To: edk2-devel@lists.01.org Date: Tue, 18 Apr 2017 10:36:52 +0800 Message-Id: <20170418023652.21128-2-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20170418023652.21128-1-hao.a.wu@intel.com> References: <20170418023652.21128-1-hao.a.wu@intel.com> Subject: [edk2] [PATCH v2 1/1] MdeModulePkg/PiSmmCore: Pad POOL_HEADER to be 8-byte aligned 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: , Cc: Hao Wu , Jiewen Yao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" According to the PI spec (Vol 4, Section 3.2 SmmAllocatePool()): The SmmAllocatePool() function ... All allocations are eight-byte aligned. The commit adds a padding field in structure 'POOL_HEADER' to ensure the above requirement is met. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.h index c12805a2dd..0692661114 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h @@ -1200,6 +1200,14 @@ typedef struct { UINTN Size; BOOLEAN Available; EFI_MEMORY_TYPE Type; + // + // According to the PI spec, buffers allocated by SmmAllocatePool should + // be 8-byte aligned. Here, the pad bytes make sure that the structure + // is 8-byte aligned: + // For IA32, sizeof (POOL_HEADER) is 16. + // For X64, sizeof (POOL_HEADER) is 24. + // + UINT32 Padding; } POOL_HEADER; =20 typedef struct { --=20 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel