From nobody Sat Nov 2 16:21:28 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 1487948719840119.87346637186204; Fri, 24 Feb 2017 07:05:19 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 00F2482164; Fri, 24 Feb 2017 07:05:16 -0800 (PST) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (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 CB60D82164 for ; Fri, 24 Feb 2017 07:05:14 -0800 (PST) Received: by mail-wr0-x235.google.com with SMTP id o22so9319247wro.1 for ; Fri, 24 Feb 2017 07:05:14 -0800 (PST) Received: from localhost.localdomain ([105.149.201.216]) by smtp.gmail.com with ESMTPSA id w207sm2687048wmw.1.2017.02.24.07.05.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 07:05:12 -0800 (PST) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ry1ipyrL6ZsNhWbUSOe31tUIKoFxO6pcpsUY8K8z6lE=; b=cXeGEnrp5PVkHqtmzMt3Rhah8wP7WmQfyPX5MTnIPyU1xfUrVJmPKWaFUFcjBR9ugG 045LZyzvoXwS2zvynTsyE9CwR4Ujsj5Z/I/7XUw30N2X96PyIJ5NrNbs2eeiptdY96C0 Moo1W7W0Y8ah1tA1QFGXmkw2Tsy8FJJjiz8pY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ry1ipyrL6ZsNhWbUSOe31tUIKoFxO6pcpsUY8K8z6lE=; b=KVlbqCJv9ZOd02eEN1/cXpuUcc1+UZYr/lkcu3RRFm2FUb38FaBbYCVfF5uOf8s2CS ZjABDXHp5vZpA3Dsyfm2zphONcRTj23YCUZMlP2FwnBt6dFd77m0pf7+3IkVm4zuGyGy /tcTe8Ry2DWdmSCOuma64tt06eHrWbHUyCiiv/Wn5Ie8/eELZqV8mINHW6Ln8DYTMMwU lyVZkDWL8LEO/aJk3f27SWKBOATdhPYoUK603F8h9EcTgQwOrFBSZgzyR/JRECLsBmcu +ULASdMDj+ITW8pdg8AO/EloHTN+HHXjOHvhIXtZ+/UljUj0ZwLOGAUVNLi4jT5Wfp6z TPGg== X-Gm-Message-State: AMke39l2u0z/ofvYrDsF/FCZ1uswqLNxjWr18QMyncvJWrMDwQlGugXDektVU/1LbUiF90gH X-Received: by 10.223.163.20 with SMTP id c20mr3315808wrb.114.1487948713266; Fri, 24 Feb 2017 07:05:13 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, afish@apple.com, leif.lindholm@linaro.org, michael.d.kinney@intel.com, liming.gao@intel.com, jiewen.yao@intel.com Date: Fri, 24 Feb 2017 15:04:57 +0000 Message-Id: <1487948699-3179-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487948699-3179-1-git-send-email-ard.biesheuvel@linaro.org> References: <1487948699-3179-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 3/5] MdeModulePkg/DxeCore: pass pool type to CoreFreePoolPages () X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: feng.tian@intel.com, lersek@redhat.com, star.zeng@intel.com, Ard Biesheuvel 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" In order to make it easier to manage memory permission attributes of page allocations performed on behalf of the pool allocator, pass the pool type when freeing pages. This way, we can easily check whether the freed pages need to have their permission attributes changed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/Mem/Imem.h | 2 ++ MdeModulePkg/Core/Dxe/Mem/Page.c | 1 + MdeModulePkg/Core/Dxe/Mem/Pool.c | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Imem.h b/MdeModulePkg/Core/Dxe/Mem/I= mem.h index fb53f95575f0..fde533100d37 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Imem.h +++ b/MdeModulePkg/Core/Dxe/Mem/Imem.h @@ -77,12 +77,14 @@ CoreAllocatePoolPages ( /** Internal function. Frees pool pages allocated via AllocatePoolPages () =20 + @param PoolType The memory type of the pool pages @param Memory The base address to free @param NumberOfPages The number of pages to free =20 **/ VOID CoreFreePoolPages ( + IN EFI_MEMORY_TYPE PoolType, IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages ); diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/P= age.c index bda4f6397e91..6330d41e7b3b 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -1871,6 +1871,7 @@ CoreAllocatePoolPages ( **/ VOID CoreFreePoolPages ( + IN EFI_MEMORY_TYPE PoolType, IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages ) diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/P= ool.c index 7afd2d312c1d..9e15e0cfb5b2 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -624,7 +624,7 @@ CoreFreePoolI ( // NoPages =3D EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (Granularity) = - 1; NoPages &=3D ~(UINTN)(EFI_SIZE_TO_PAGES (Granularity) - 1); - CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN) Head, NoPages); + CoreFreePoolPages (Pool->MemoryType, (EFI_PHYSICAL_ADDRESS) (UINTN) He= ad, NoPages); =20 } else { =20 @@ -680,7 +680,8 @@ CoreFreePoolI ( // // Free the page // - CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN)NewPage, EFI_SIZE= _TO_PAGES (Granularity)); + CoreFreePoolPages (Pool->MemoryType, (EFI_PHYSICAL_ADDRESS) (UINTN= )NewPage, + EFI_SIZE_TO_PAGES (Granularity)); } } } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel