From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,217,1488873600"; d="scan'208";a="75386368" 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 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Jiewen Yao 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: [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: , X-List-Received-Date: Tue, 18 Apr 2017 02:36:57 -0000 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/PiSmmCore/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; typedef struct { -- 2.12.0.windows.1