From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.92.19.18]) by mx.groups.io with SMTP id smtpd.web11.426.1594338703503343844 for ; Thu, 09 Jul 2020 16:51:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=cYVgvVxc; spf=pass (domain: outlook.com, ip: 40.92.19.18, mailfrom: spbrogan@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPSq/8UrQC/tw+HY9HFNO2jEnIBMO3EQXhDXYe/4atuh3+4oBXO39KRPZ8r5BAV3LSN+Z8x30lFgOSLwAvpcnb1P/NQrtEqRysqNjoCtdspLFPUtG+xhT2z+qyJV77LBQogmX8sOmNNNXoou1VMnNlSpN5lmxTebLG2yjPE4nxX+di48psnUhuPTZ2k6bVXbpjVlEN/kkI2GOtD8VW0U1fJBq00KHjC60HZMFwAcJXthX65bs83UYCfPMxEimogLXnxkrpZdNgFSiezw2OrTB4xzHN/eD0C8i6cWP/ucItMFAq4Epyx6pJ2NuEZWAFRGDX4SwIOf+JO41/jvogfx4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J/sURv+wD+BcoAMSUlyW04NbJyrOtjEZnsqYElRv4SY=; b=i89K5/9Qt3fHWhHd33WIC3LLKY03BBOgjwjjTAbRhQTyXYvald6Nab52twOtBOkFdwd1HvaDojxQ2xrcAm1qAVN2GEIHLkOlcCQFFxwKUH2jQgo/8a2Krv3uCyPwdp2HPMOGAw7iLwXfuBN29Qpw02ItrB+TdUaxwonycaVbZ99NCPt7A7BPdQoUbw2+QmE7CHkverFCo5SpMw/yTk8RxU9iRSohktZNCP3FJJP/XZeH/vFAAQ18cqaJpYr04VrGmcafrR45FGT6trphVq5tLqBMjCZvDmrR1Fg2bHFMgVLkJgT7W6Z1ynJXv6FZabWdrxCeiHKa7twzICSDuC29pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J/sURv+wD+BcoAMSUlyW04NbJyrOtjEZnsqYElRv4SY=; b=cYVgvVxc/1OEeXotVWtCqzrx/mC3e68FXiRbxBBoMI97Hl/Gjf4tlFSJE+nTKnaRzrbzqlcBcVKa6V63fTZHHt9ekHUQv3u9hyo0uZUNM8RpwAM4Ex3tOrP4rG3YXBhF6fI4Uj82UM5aI9zM5sa1aeyk2+9gg4VTvjRZN+x3UxNwi2w3kaHcg5z/CFix9mMH/rYZUI9zhQTqQBcUCOTzD6avgl7nMNExE9FAXqFnX41s/G/O5AGSjAt8QAZxmiWeFkuvwH96Dx2UdryLr3Cnix7+syvPIn1J4YJxFbS7YdSIt8qnlYzUiu2gnUlw1OK27VJ8IzlE2Vgm/UnS5mw/zQ== Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::50) by BN8NAM11HT182.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21; Thu, 9 Jul 2020 23:51:42 +0000 Received: from BN8PR07MB6962.namprd07.prod.outlook.com (2a01:111:e400:fc4b::48) by BN8NAM11FT036.mail.protection.outlook.com (2a01:111:e400:fc4b::424) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Thu, 9 Jul 2020 23:51:42 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:BD00F0623A056F27F93B7AE39AEBFE96C66C938FFEF6DE118D7EB912F075B809;UpperCasedChecksum:F3B9AE9D5C6BAF4339C5BB160186D6EAE89FAF127A2CF3684A2E5BAC8BCFD579;SizeAsReceived:8988;Count:49 Received: from BN8PR07MB6962.namprd07.prod.outlook.com ([fe80::4115:2eac:5a88:50b9]) by BN8PR07MB6962.namprd07.prod.outlook.com ([fe80::4115:2eac:5a88:50b9%7]) with mapi id 15.20.3174.023; Thu, 9 Jul 2020 23:51:42 +0000 Subject: Re: [edk2-devel] [Patch v2 02/16] MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing To: devel@edk2.groups.io, michael.d.kinney@intel.com Cc: Liming Gao , Sean Brogan , Bret Barkelew , Jiewen Yao References: <20200709040521.3748-1-michael.d.kinney@intel.com> <20200709040521.3748-3-michael.d.kinney@intel.com> From: "Sean" Message-ID: Date: Thu, 9 Jul 2020 16:51:39 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <20200709040521.3748-3-michael.d.kinney@intel.com> X-ClientProxiedBy: MWHPR15CA0072.namprd15.prod.outlook.com (2603:10b6:301:4c::34) To BN8PR07MB6962.namprd07.prod.outlook.com (2603:10b6:408:d6::11) Return-Path: spbrogan@outlook.com X-Microsoft-Original-Message-ID: <219ef851-8467-c2fe-feb8-e2c573808f69@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.78] (50.47.113.221) by MWHPR15CA0072.namprd15.prod.outlook.com (2603:10b6:301:4c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Thu, 9 Jul 2020 23:51:41 +0000 X-Microsoft-Original-Message-ID: <219ef851-8467-c2fe-feb8-e2c573808f69@outlook.com> X-TMN: [bh0fnKLHKsk1Rwsb9jG5lIcVivMO/MoU] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 2afeba99-e88e-4e6b-6f95-08d82463076d X-MS-TrafficTypeDiagnostic: BN8NAM11HT182: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: APPmImuccWUkfIngmqa4r0WreFlbzJBI51qo/UUtW2LU0e68QzwWtjrK2HwBjvl3hRHSmTT6OEEbBlLB1FqQyzmzqshwN0mTLQsTmXPxfb32F19eaTU/Sl2BdIIKqa1gUnoK27VISJiYSf83EEEkS3ekNIa7m48o39N+df4HLxneF283vWaYiC6LVVbT7QnKOQ3wJbKvPYT+C0mYmigqDTg/ym2tqS2xuNoz6CAtEKFeWCKshRfaiBBzokrBXtvM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR07MB6962.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: gnMhGt0F3ZyjRZ/6QvAIjfBrZhH5hlJ3BFo/zRnPf1HYRW+fcN7ZVbSXP8kkvgDT27kP66me5fRZSGPq2lJBIWALJyHGyTtCBrIndIhZtBPfRelNVgVw8mcOqQaHJt75Uh64WZGENoQfGufTBT+Qgw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2afeba99-e88e-4e6b-6f95-08d82463076d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2020 23:51:42.0359 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT182 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Reviewed-by: Sean Brogan On 7/8/2020 9:05 PM, Michael D Kinney wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2798 > > The services in CpuLib usually generate exceptions in a unit test > host application. Provide a Null instance that can be safely used. > > This Null instance can also be used as a template for implementing > new instances of CpuLib. > > Cc: Liming Gao > Cc: Sean Brogan > Cc: Bret Barkelew > Cc: Jiewen Yao > Signed-off-by: Michael D Kinney > --- > .../Library/BaseCpuLibNull/BaseCpuLibNull.c | 37 +++++++++++++++++++ > .../Library/BaseCpuLibNull/BaseCpuLibNull.inf | 26 +++++++++++++ > .../Library/BaseCpuLibNull/BaseCpuLibNull.uni | 11 ++++++ > MdePkg/MdePkg.dsc | 3 +- > 4 files changed, 76 insertions(+), 1 deletion(-) > create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c > create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf > create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni > > diff --git a/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c > new file mode 100644 > index 0000000000..3ba7a35096 > --- /dev/null > +++ b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c > @@ -0,0 +1,37 @@ > +/** @file > + Null instance of CPU Library. > + > + Copyright (c) 2020, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/** > + Places the CPU in a sleep state until an interrupt is received. > + > + Places the CPU in a sleep state until an interrupt is received. If interrupts > + are disabled prior to calling this function, then the CPU will be placed in a > + sleep state indefinitely. > + > +**/ > +VOID > +EFIAPI > +CpuSleep ( > + VOID > + ) > +{ > +} > + > +/** > + Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > + > + Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > + > +**/ > +VOID > +EFIAPI > +CpuFlushTlb ( > + VOID > + ) > +{ > +} > diff --git a/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf > new file mode 100644 > index 0000000000..a9e8399038 > --- /dev/null > +++ b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf > @@ -0,0 +1,26 @@ > +## @file > +# Null instance of CPU Library. > +# > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = BaseCpuLibNull > + MODULE_UNI_FILE = BaseCpuLibNull.uni > + FILE_GUID = 8A29AAA5-0FB7-44CC-8709-1344FE89B878 > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = CpuLib > + > +# > +# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64 RISCV64 > +# > + > +[Sources] > + BaseCpuLibNull.c > + > +[Packages] > + MdePkg/MdePkg.dec > diff --git a/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni > new file mode 100644 > index 0000000000..1030221d5c > --- /dev/null > +++ b/MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni > @@ -0,0 +1,11 @@ > +// /** @file > +// Null instance of CPU Library. > +// > +// Copyright (c) 2020, Intel Corporation. All rights reserved.
> +// SPDX-License-Identifier: BSD-2-Clause-Patent > +// > +// **/ > + > +#string STR_MODULE_ABSTRACT #language en-US "Null Instance of CPU Library" > + > +#string STR_MODULE_DESCRIPTION #language en-US "Null instance of CPU Library." > diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc > index 6cd38e7ec3..3abe65ec7f 100644 > --- a/MdePkg/MdePkg.dsc > +++ b/MdePkg/MdePkg.dsc > @@ -1,7 +1,7 @@ > ## @file > # EFI/PI MdePkg Package > # > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> +# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.
> # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
> # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> # > @@ -36,6 +36,7 @@ [Components] > MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf > MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > + MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf > MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf > MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf >