From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 85A7A941F18 for ; Mon, 27 Nov 2023 23:58:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1xSWtqvy3O2XOTf5ZLTGrmf5POLUXv7nKZ6Y41CieHE=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701129520; v=1; b=qYTXpVfYaJgfH3wuesfCPSZ0ivrQ+ojz4fDjOTLwObUK7IOO+9qPTHVrkKMRZXifDm8ZtbeJ eYhpDmvSbPRx0SD+eUfyCDPVtRzt9SMXUMDvEO+OXz7DJnfb9qSy3FhMGJ5NwHUEYx3cLPKWoqJ Raze9YLQezHI7ou20hbPGGLs= X-Received: by 127.0.0.2 with SMTP id xCzcYY7687511x0UqA9KU6jP; Mon, 27 Nov 2023 15:58:40 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.117012.1701129519479635942 for ; Mon, 27 Nov 2023 15:58:39 -0800 X-Received: from localhost.localdomain (unknown [47.201.241.198]) by linux.microsoft.com (Postfix) with ESMTPSA id 64F6020B74C0; Mon, 27 Nov 2023 15:58:38 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 64F6020B74C0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar Subject: [edk2-devel] [PATCH v1 1/1] ArmPkg/ArmMmuLib: Use function pointer type Date: Mon, 27 Nov 2023 18:57:43 -0500 Message-ID: <20231127235743.1055-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: pW5lhmb7DCQjZXtgN6syzNl7x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=qYTXpVfY; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Michael Kubacki mReplaceLiveEntryFunc is a function pointer but assigned as a VOID* pointer: mReplaceLiveEntryFunc =3D *(VOID **)GET_GUID_HOB_DATA (Hob); This leads to the Visual Studio warning: nonstandard extension, function/data pointer conversion in expression This change updates the assignment to avoid using a data pointer and defines a type for the function pointer to succinctly and accurately refer to the type when it is used in the library code. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Signed-off-by: Michael Kubacki --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 13 +++-----= --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c | 7 +++--- ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 2 ++ ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h | 23 ++++++++= ++++++++++++ ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf | 1 + 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Li= brary/ArmMmuLib/AArch64/ArmMmuLibCore.c index 1e57e589977e..9d9c623581fe 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -20,16 +20,9 @@ #include #include #include +#include "ArmMmuLibInternal.h" =20 -STATIC -VOID ( - EFIAPI *mReplaceLiveEntryFunc - )( - IN UINT64 *Entry, - IN UINT64 Value, - IN UINT64 RegionStart, - IN BOOLEAN DisableMmu - ) =3D ArmReplaceLiveTranslationEntry; +STATIC ARM_REPLACE_LIVE_TRANSLATION_ENTRY mReplaceLiveEntryFunc =3D Ar= mReplaceLiveTranslationEntry; =20 STATIC UINT64 @@ -742,7 +735,7 @@ ArmMmuBaseLibConstructor ( =20 Hob =3D GetFirstGuidHob (&gArmMmuReplaceLiveTranslationEntryFuncGuid); if (Hob !=3D NULL) { - mReplaceLiveEntryFunc =3D *(VOID **)GET_GUID_HOB_DATA (Hob); + mReplaceLiveEntryFunc =3D *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY *)GET= _GUID_HOB_DATA (Hob); } else { // // The ArmReplaceLiveTranslationEntry () helper function may be invo= ked diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c b= /ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c index 5f50a605a338..a0c9facdea64 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c @@ -13,6 +13,7 @@ #include #include #include +#include "ArmMmuLibInternal.h" =20 EFI_STATUS EFIAPI @@ -21,9 +22,9 @@ ArmMmuPeiLibConstructor ( IN CONST EFI_PEI_SERVICES **PeiServices ) { - extern UINT32 ArmReplaceLiveTranslationEntrySize; - VOID *ArmReplaceLiveTranslationEntryFunc; - VOID *Hob; + extern UINT32 ArmReplaceLiveTranslationEntrySize= ; + ARM_REPLACE_LIVE_TRANSLATION_ENTRY ArmReplaceLiveTranslationEntryFunc= ; + VOID *Hob; =20 EFI_FV_FILE_INFO FileInfo; EFI_STATUS Status; diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/= ArmMmuLib/ArmMmuBaseLib.inf index 57cb71f90ee3..510511bd414f 100644 --- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf +++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf @@ -19,10 +19,12 @@ [Defines.AARCH64] CONSTRUCTOR =3D ArmMmuBaseLibConstructor =20 [Sources.AARCH64] + ArmMmuLibInternal.h AArch64/ArmMmuLibCore.c AArch64/ArmMmuLibReplaceEntry.S =20 [Sources.ARM] + ArmMmuLibInternal.h Arm/ArmMmuLibConvert.c Arm/ArmMmuLibCore.c Arm/ArmMmuLibUpdate.c diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h b/ArmPkg/Librar= y/ArmMmuLib/ArmMmuLibInternal.h new file mode 100644 index 000000000000..8d3bec525d8e --- /dev/null +++ b/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h @@ -0,0 +1,23 @@ +/** @file + Arm MMU library instance internal header file. + + Copyright (C) Microsoft Corporation. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ARM_MMU_LIB_INTERNAL_H_ +#define ARM_MMU_LIB_INTERNAL_H_ + +typedef +VOID( + EFIAPI *ARM_REPLACE_LIVE_TRANSLATION_ENTRY + )( + IN UINT64 *Entry, + IN UINT64 Value, + IN UINT64 RegionStart, + IN BOOLEAN DisableMmu + ); + +#endif diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf b/ArmPkg/Library/A= rmMmuLib/ArmMmuPeiLib.inf index 02f874a1a994..37424628aa07 100644 --- a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf +++ b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf @@ -17,6 +17,7 @@ [Defines] CONSTRUCTOR =3D ArmMmuPeiLibConstructor =20 [Sources.AARCH64] + ArmMmuLibInternal.h AArch64/ArmMmuLibCore.c AArch64/ArmMmuPeiLibConstructor.c AArch64/ArmMmuLibReplaceEntry.S --=20 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111765): https://edk2.groups.io/g/devel/message/111765 Mute This Topic: https://groups.io/mt/102841630/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-