From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.5359.1588856830404711144 for ; Thu, 07 May 2020 06:07:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=D26v58bl; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qq++KV3i9h+xHnUN+J+WlZdKekEkumhN1FHy/vLJjioF+5O78gth9NONI8hAyCHhYqanzrqiNrf3oV/gu2jeLekgD2jNhJmfGlLvmYBaIHI2xfHCNtQ9+KvBOZ/VcfBSccIjkPbAU+6DbRvqINxrtdB/TO6xwthfD/z3SYSvJDXEp9CPQBUzgkyDkLIBzcO70ZryNiFx2C/iMTKFfZ6gQMSqvxPLQxjYE2BM2F+TClQv2PvPPAFnDgd06zmK9XECxT1iWmy2Zhw6TYYfnbGnZedy1wxFRgXlHbPmsyoLi8tqnGW34c8enPeZ0HxsINsauAv5m1tN25Nr2Fqi1yuD9Q== 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=gRbx+mPmv3/gqk972jtO6N7AVyfjH/Rd5ylvrBysAcE=; b=jLFeYI9xe+MXvBU9KUm4g+mfMsUH6uFbV0dMsYQTlQmmxbs8qMn6FOG9hfd6HxG7wvzwDOnIpaWu9q2pyb5d7gnX/0dihfBfw+TE4VORPLa16uw00wtWWtf75gduOfU5e7MDVfNLEsWYYFNynKzMZNBPqNHrjVZ96U0abiipYJrbJHxiidhek+hFQ3fXZhPJyW280MZ6RRo8lh7Boz0CkHs748xJlB+espXFiknXtZMmoFG7U7+mvFdZv5kKUt5It08Yk/Dwwf/SSEtDkMjo6OdfE1ZD+s4Y4+iQ+tjR7PJEKZAClzY1nhCWd6lh/YGSIJXgo2jtlM53Nl4rhphc/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gRbx+mPmv3/gqk972jtO6N7AVyfjH/Rd5ylvrBysAcE=; b=D26v58blBAcSm8j4C9qgVfU6edEwGau9x8Wpc91bDNfDqbgoECghUR8BPrdzHmfgawbm1n5VmMnICXQQS1kI4AMKq0N1+QyBVR7Sc/imNk1X1JjGuIAPDdH/T8VHWcFD7Q4/zUNAJn/eCEkBjofHt0JJ8TV+sBrR0cisHpFoHpc= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR12MB1819.namprd12.prod.outlook.com (2603:10b6:3:113::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 7 May 2020 13:07:09 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4ce1:9947:9681:c8b1%10]) with mapi id 15.20.2958.034; Thu, 7 May 2020 13:07:09 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Liming Gao , Eric Dong , Ray Ni , Anthony Perard , Julien Grall , Brijesh Singh , Andrew Fish Subject: [PATCH v3 1/3] UefiCpuPkg/CpuExceptionHandler: Make XCODE5 changes toolchain specific Date: Thu, 7 May 2020 08:06:48 -0500 Message-Id: <9075570487616c731033a5738f6a444a15d71b74.1588856809.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN1PR12CA0109.namprd12.prod.outlook.com (2603:10b6:802:21::44) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN1PR12CA0109.namprd12.prod.outlook.com (2603:10b6:802:21::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28 via Frontend Transport; Thu, 7 May 2020 13:07:08 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0621685c-d321-4857-6404-08d7f2878ca6 X-MS-TrafficTypeDiagnostic: DM5PR12MB1819:|DM5PR12MB1819: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-Forefront-PRVS: 03965EFC76 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xS+j14r1pqufUD8Ty9gEz1KqBpi1387MxrbgvwII6dv45S1QcwLr7zUoamlNOI82jinTjT0gbTklpE7pz7B+4f9Tgfepo3QMp7V3vJqQpiR1ZIPpUE4+vNa8eJMl40aVSRXfH5D9jLadiO5X28ZbT4VvJ43oQeHNFM/PfJlxiKDh+xFyXxtoiKMKk61G1s2Xkydza5zfw1aKMRhI/lfoWBCzHaRIbiiBEuWMQ3XgjROdaTOFhx9rFyGE6B78ldXH3juEHTmW4rlN2ABNw7tAQ9T1TPprANAyzDNb09p9HW1qCqut++LJHCVaG+MS3Ln41JjCJ/WNSNQNKLPwSBDT4EcWjBLUhf68nPp/SZMe+nXL+1jOvlfAsRJrY6C9Q2xiXsl7VFvGjXsYp46y+QlsX1faK4LiaGBXNgM/zaHvcxc07hjJC3zJet+y4xaEf7Oz4F5xTTUSg9j35EEw+fsnJ/D9MTxiEJ8dF/7wfzFl6q8cGdReFLSXeZTkM06qvg146n1gWa4gXSBMISaH9Zrk8GLtwEzTXtRSMwIxzFyS7YP8w2VPDJi21cwGY/pKlDY6HIH58Ja4Va1u4WkE7IDvDTr/pTHDiPwilBrkKoOmxrX6B3ifUTzfNlVP/NgrJO3qJpczdigbFj6c1g9f16qtQQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(136003)(39860400002)(396003)(376002)(346002)(33430700001)(33440700001)(86362001)(83320400001)(478600001)(4326008)(6666004)(66946007)(83300400001)(316002)(83310400001)(83280400001)(83290400001)(54906003)(36756003)(966005)(2616005)(956004)(7416002)(7696005)(26005)(6916009)(2906002)(5660300002)(52116002)(16526019)(6486002)(8936002)(8676002)(19627235002)(66556008)(66476007)(186003)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: R5aOwWX3vtTh4U9Jap9A+uSlydggNFIcBNzpETJl1yXEMMlub6yH8Rglbfv4JxnVh8f+zIp+YKxiDhHn1T3o2q/xP8NUpmJEzr1SQbXOGfC61Svb5wBWwsy2EisnMSKywITMgW812NW5RHsSNuer0LO57AvNol9+/rChXYbNz75m2yH4in5Bs508/D0q6nt8Qd14+4b/N4Ng1I7SGl+lhOijfDeFwrE66Qo9gep5bGhnevkcTvC9fNmkVxI44WAgCNdJwU2eQSRum2emK9NJxfcA/Kwn3d4EH9FCRAOBo5Z2hZfex/F42bFWCANXP5aQY7bt7TNpebKiTNWJjwjHWY/+KHTAXB8z7ePpM8mLaFSULggTbq0WcQsLFkvcBRw7A+l5ffEhWfSGa4sb80Hzgf69VydIgUrjbsjB1ld/eTvzQ2UWex8LIfXsqfKHoLSjW0bNSx8NdcgweBxOhbn1TrWfW30ukVAt5ltbUWu19HtgToJsdpXXMO+s3shNl6InbqnCaWUHnxcwj/+qer3YV4Nx7bKqQnNYsGTNYTpBFdOsu4rBeotf7loBgqkga/nm4La827ZCD4ubVfQjAdMqEjlIaqnp7K6kxh/HESW3VSVv80VVLQyy46UDhRNqWuxiLb8DeCHY5GhN0vDTZ2cX6xfErHs2oj4/TOnkoW/KpH02BZ5zc6YFNdP1n777Qav949aQUzDJae/DXK+FFRMzTd9S2JvwZynxrF2q06cqSpPSvIZC8elEbPN9jmk/uyZ/TX1YVDlRU3W0pmmVyCkCz8XeUmVqLIBJ6MSIayU8xSc= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0621685c-d321-4857-6404-08d7f2878ca6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2020 13:07:09.3744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9SjmYCgMRXxxBHaQoyi4ylI1XMxjeg/ja4r5xoRMoAKFQfbTK4nRu/OrRmK2as31mcsn6K24azVIpKSg8DwSxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1819 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2340 Commit 2db0ccc2d7fe ("UefiCpuPkg: Update CpuExceptionHandlerLib pass XCODE5 tool chain") introduced binary patching into the exception handling support. CPU exception handling is allowed during SEC and this results in binary patching of flash, which should not be done. Separate the changes from commit 2db0ccc2d7fe into an XCODE5 toolchain specific file, Xcode5ExceptionHandlerAsm.nasm, and create a new SEC INF file for the XCODE5 version of CpuExceptionHandlerLib. Since binary patching is allowed when running outside of flash, switch the Dxe, Pei and Smm versions of the CpuExceptionHandlerLib over to use the Xcode5ExceptionHandlerAsm.nasm file to retain current functionality. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Liming Gao Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- UefiCpuPkg/UefiCpuPkg.dsc | 7 +++++++ .../DxeCpuExceptionHandlerLib.inf | 2 +- .../PeiCpuExceptionHandlerLib.inf | 2 +- .../SmmCpuExceptionHandlerLib.inf | 2 +- ... => Xcode5SecPeiCpuExceptionHandlerLib.inf} | 13 +++++++++---- ...Asm.nasm => Xcode5ExceptionHandlerAsm.nasm} | 0 .../Xcode5SecPeiCpuExceptionHandlerLib.uni | 18 ++++++++++++++++++ 7 files changed, 37 insertions(+), 7 deletions(-) copy UefiCpuPkg/Library/CpuExceptionHandlerLib/{SecPeiCpuExceptionHandlerLib.inf => Xcode5SecPeiCpuExceptionHandlerLib.inf} (64%) copy UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{ExceptionHandlerAsm.nasm => Xcode5ExceptionHandlerAsm.nasm} (100%) create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index d28cb5cccb52..afa304128221 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -59,7 +59,11 @@ [LibraryClasses] [LibraryClasses.common.SEC] PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf +!if $(TOOL_CHAIN_TAG) == "XCODE5" + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf +!else CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf +!endif HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf @@ -123,9 +127,12 @@ [Components.IA32, Components.X64] UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf +!if $(TOOL_CHAIN_TAG) != "XCODE5" UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf +!endif UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf + UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf index e41383573043..61e2ec30b089 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h [Sources.X64] - X64/ExceptionHandlerAsm.nasm + X64/Xcode5ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf index f31423ac0f91..093374944df6 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h [Sources.X64] - X64/ExceptionHandlerAsm.nasm + X64/Xcode5ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf index 66c7f59e3c91..2ffbbccc302f 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf @@ -28,7 +28,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h [Sources.X64] - X64/ExceptionHandlerAsm.nasm + X64/Xcode5ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf similarity index 64% copy from UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf copy to UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf index 6d25cafe2ca3..7e21beaab6f2 100644 --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf @@ -1,16 +1,21 @@ ## @file # CPU Exception Handler library instance for SEC/PEI modules. # +# Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # +# This is the XCODE5 variant of the SEC/PEI CpuExceptionHandlerLib. This +# variant performs binary patching to fix up addresses that allow the +# XCODE5 toolchain to be used. +# ## [Defines] INF_VERSION = 0x00010005 - BASE_NAME = SecPeiCpuExceptionHandlerLib - MODULE_UNI_FILE = SecPeiCpuExceptionHandlerLib.uni - FILE_GUID = CA4BBC99-DFC6-4234-B553-8B6586B7B113 + BASE_NAME = Xcode5SecPeiCpuExceptionHandlerLib + MODULE_UNI_FILE = Xcode5SecPeiCpuExceptionHandlerLib.uni + FILE_GUID = 49C481AF-1621-42F3-8FA1-27C64143E304 MODULE_TYPE = PEIM VERSION_STRING = 1.1 LIBRARY_CLASS = CpuExceptionHandlerLib|SEC PEI_CORE PEIM @@ -28,7 +33,7 @@ [Sources.Ia32] Ia32/ArchInterruptDefs.h [Sources.X64] - X64/ExceptionHandlerAsm.nasm + X64/Xcode5ExceptionHandlerAsm.nasm X64/ArchExceptionHandler.c X64/ArchInterruptDefs.h diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm similarity index 100% copy from UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm copy to UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni new file mode 100644 index 000000000000..a63b25f39d99 --- /dev/null +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.uni @@ -0,0 +1,18 @@ +// /** @file +// XCODE5 CPU Exception Handler library instance for SEC/PEI modules. +// +// CPU Exception Handler library instance for SEC/PEI modules when built +// using the XCODE5 toolchain. +// +// Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
+// Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for SEC/PEI modules with the XCODE5 toolchain." + +#string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for SEC/PEI modules with the XCODE5 toolchain." + -- 2.17.1