From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=O1CXjLvQ; spf=pass (domain: linaro.org, ip: 209.85.214.194, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by groups.io with SMTP; Thu, 11 Apr 2019 11:58:36 -0700 Received: by mail-pl1-f194.google.com with SMTP id g12so3825542pll.11 for ; Thu, 11 Apr 2019 11:58:36 -0700 (PDT) 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=s7ZO2eWkn/jCyIskVuZkA++UKez5KpuIoAyNWwq19l0=; b=O1CXjLvQFczrx8H9k97+ebupH64dS9SZEVntlA6iwsqhBTnb9maCwRiuJ5S+1Mh1LD 6twu2aq2i7SWhxjITkhaJLzvDFIEpArjL8e9nLoTMtRM+VvFfRFNFtB99zgzE2StWEHA K74nu5oAnxF9iDhDIDlGuQlbEzfhYu0PIdd5ol+CnR0UyxD/Ixr+Md4BTX2LrCGBlrgn A6jklsjp1lnjmyXhiRyx8tJYg6v+aOs2oZIcF9yv5Wmx0KmilFN6eiNwgkN993nzrQpn 4CVe6HcMUFPZ61KrjLYnalolsybopPLonPunFf89oNovZ6SKDrLyZzU7t4seL7yr/Whm R+/A== 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=s7ZO2eWkn/jCyIskVuZkA++UKez5KpuIoAyNWwq19l0=; b=Oqz8TwHxwn6spLws9h0aEBVFDFCm1+YBSUZLXxa9Nuu9IboYBXNoSANEk6uW9Iq2yf BlTNYAFUbVBdNjCT/hmJ8VHgKQfFwLRpfjZQMvXcqjRbBkd2PhMHHauogWg+NxkOvqAL U2zr+fKc7zvzO5KzKvO7zGG62z83h8zZIYD42Yd22REJSggtxik7rdCrm6z50D6doe/p tJQKz+e9vsVR4G88qqhjIidglZNDY+WNsDBGHNZZnaldSEdh0dOkvoKYJrVJZTdSCt3v 5MGvkj1ZgXkumVR3ayHVkUmxPXL9VqVA5HsgHuio39IfmwBi3RpokZnUUBxd19+7puOx +EEw== X-Gm-Message-State: APjAAAWRtO/cs7J2D2Qm1ZILiyzOMXt3d9p7vqKbQh/oNdm6iybZJL14 yiQroyOCSm213g3GZTruIDtF1SX3cUiZr+Pf X-Google-Smtp-Source: APXvYqwdyKGF7mR0OP/w2UV+fjkTMjQC4MEwWcYaYiMpiUxFt8uDYeoN4dQosy23hkT+OU24CdIKyA== X-Received: by 2002:a17:902:4681:: with SMTP id p1mr51711655pld.42.1555009115419; Thu, 11 Apr 2019 11:58:35 -0700 (PDT) Return-Path: Received: from localhost.localdomain (50-205-23-12-static.hfc.comcastbusiness.net. [50.205.23.12]) by smtp.gmail.com with ESMTPSA id w3sm82712861pfn.179.2019.04.11.11.58.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 11:58:33 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Vincent Zimmer , Brian Richardson , Michael D Kinney , Andrew Fish , Leif Lindholm , Star Zeng , Eric Dong , Ruiyu Ni , Liming Gao , Jaben Carsey , Steven Shi Subject: [PATCH v5 7/7] MdeModulePkg/DxeCore: remove explicit EBC handling Date: Thu, 11 Apr 2019 11:58:13 -0700 Message-Id: <20190411185813.2084-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190411185813.2084-1-ard.biesheuvel@linaro.org> References: <20190411185813.2084-1-ard.biesheuvel@linaro.org> Now that the EBC machine type is no longer classified as a natively supported machine type on the architectures that can support it via the EBC interpreter, the EBC specific handling in DXE core is no longer used and can be removed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/DxeMain.h | 3 -- MdeModulePkg/Core/Dxe/DxeMain.inf | 1 - MdeModulePkg/Core/Dxe/Image/Image.c | 53 ++------------------ 3 files changed, 3 insertions(+), 54 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 48ec30a48aa2..6e83f15a4541 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -42,7 +42,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include @@ -227,8 +226,6 @@ typedef struct { BASE_LIBRARY_JUMP_BUFFER *JumpContext; /// Machine type from PE image UINT16 Machine; - /// EBC Protocol pointer - EFI_EBC_PROTOCOL *Ebc; /// PE/COFF Image Emulator Protocol pointer EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *PeCoffEmu; /// Runtime image list diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index ce6fc19be5e4..68413517f2a7 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -160,7 +160,6 @@ gEfiLoadedImageProtocolGuid ## PRODUCES gEfiLoadedImageDevicePathProtocolGuid ## PRODUCES gEfiHiiPackageListProtocolGuid ## SOMETIMES_PRODUCES - gEfiEbcProtocolGuid ## SOMETIMES_CONSUMES gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES gEdkiiPeCoffImageEmulatorProtocolGuid ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index d00e50747040..565008177e96 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -75,7 +75,6 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage = { NULL, // JumpBuffer NULL, // JumpContext 0, // Machine - NULL, // Ebc NULL, // PeCoffEmu NULL, // RuntimeData NULL // LoadedImageDevicePath @@ -92,9 +91,6 @@ typedef struct { CHAR16 *MachineTypeName; } MACHINE_TYPE_INFO; -// -// EBC machine is not listed in this table, because EBC is in the default supported scopes of other machine type. -// GLOBAL_REMOVE_IF_UNREFERENCED MACHINE_TYPE_INFO mMachineTypeInfo[] = { {EFI_IMAGE_MACHINE_IA32, L"IA32"}, {EFI_IMAGE_MACHINE_IA64, L"IA64"}, @@ -773,51 +769,15 @@ CoreLoadPeImage ( InvalidateInstructionCacheRange ((VOID *)(UINTN)Image->ImageContext.ImageAddress, (UINTN)Image->ImageContext.ImageSize); // - // Copy the machine type from the context to the image private data. This - // is needed during image unload to know if we should call an EBC protocol - // to unload the image. + // Copy the machine type from the context to the image private data. // Image->Machine = Image->ImageContext.Machine; // - // Get the image entry point. If it's an EBC image, then call into the - // interpreter to create a thunk for the entry point and use the returned - // value for the entry point. + // Get the image entry point. // Image->EntryPoint = (EFI_IMAGE_ENTRY_POINT)(UINTN)Image->ImageContext.EntryPoint; - if (Image->ImageContext.Machine == EFI_IMAGE_MACHINE_EBC) { - // - // Locate the EBC interpreter protocol - // - Status = CoreLocateProtocol (&gEfiEbcProtocolGuid, NULL, (VOID **)&Image->Ebc); - if (EFI_ERROR(Status) || Image->Ebc == NULL) { - DEBUG ((DEBUG_LOAD | DEBUG_ERROR, "CoreLoadPeImage: There is no EBC interpreter for an EBC image.\n")); - goto Done; - } - - // - // Register a callback for flushing the instruction cache so that created - // thunks can be flushed. - // - Status = Image->Ebc->RegisterICacheFlush (Image->Ebc, (EBC_ICACHE_FLUSH)InvalidateInstructionCacheRange); - if (EFI_ERROR(Status)) { - goto Done; - } - - // - // Create a thunk for the image's entry point. This will be the new - // entry point for the image. - // - Status = Image->Ebc->CreateThunk ( - Image->Ebc, - Image->Handle, - (VOID *)(UINTN) Image->ImageContext.EntryPoint, - (VOID **) &Image->EntryPoint - ); - if (EFI_ERROR(Status)) { - goto Done; - } - } else if (Image->PeCoffEmu != NULL) { + if (Image->PeCoffEmu != NULL) { Status = Image->PeCoffEmu->RegisterImage (Image->PeCoffEmu, Image->ImageBasePage, EFI_PAGES_TO_SIZE (Image->NumberOfPages), @@ -1007,13 +967,6 @@ CoreUnloadAndCloseImage ( UnprotectUefiImage (&Image->Info, Image->LoadedImageDevicePath); - if (Image->Ebc != NULL) { - // - // If EBC protocol exists we must perform cleanups for this image. - // - Image->Ebc->UnloadImage (Image->Ebc, Image->Handle); - } - if (Image->PeCoffEmu != NULL) { // // If the PE/COFF Emulator protocol exists we must unregister the image. -- 2.17.1