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=eBDIcqnV; spf=pass (domain: linaro.org, ip: 209.85.210.194, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by groups.io with SMTP; Sun, 14 Apr 2019 12:53:01 -0700 Received: by mail-pf1-f194.google.com with SMTP id b3so7531349pfd.1 for ; Sun, 14 Apr 2019 12:53:01 -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=lcdk3p3NizyFtzAeta1909slOkXGRCT1A8jax9fH+Hc=; b=eBDIcqnV6pxNcdFe17gyq/0zyPweLFmKbogrkfuBQfDjvH+DwkNNdcgKW2yFOJyQPF uVEROO8L5XdBmTzM+AqLTSIwu/sco9gqb50/KSXHqwKj+ud2ipmrEY+6fSH/yqNZs8bO GLsg0UvYUECJdRXizcTpQPP70KIjQRp37bQ4lVV50N2KKkeEF8Deyjs2FgjFkFZN3zKy 3eN+TGdss5VIvzpHEvigmgGFKTCeGogVT5a754i/ez3nxpUTk9w8skesub6sUG6Axhe5 nrCn8Y2fiKu6GaHmbjY1PigFdnGx7tRkTDe1wC6H77eMRh8PtzIW9av93NgCdQstHtjz B+/w== 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=lcdk3p3NizyFtzAeta1909slOkXGRCT1A8jax9fH+Hc=; b=Iwj8PzX22Bj2qrl8bOWIXCmG1cXY0t31jGHSg3LCnGdIwvyT0l8n08yQL20WAOrl7C EO3FJnjJpAmz6+k4vJWwCyr5AZGyiMexFA5OkxGZGVUPTsRF0cU4w3RoV9M7o81D63bc fUzAN1TOZGHMAB05l2TVj8LLO6ORUUVNKsJGDKlK9YOY7Y5fIRbmOx2RYwSVqEM4bq8C kNTcauPdhZwwbl7XIp4msJSHLhE32aXVCXRMa0bcFw5kZzCLiIFQtwXkv8n8xlxr9wMS aM87ObxdY3WO2tmZaYCSlVBVfdSFbArj69O03tyrWK2hs10F5FtF4nWQUg66AxOKbXkw /6NQ== X-Gm-Message-State: APjAAAX6n396GiW/YmUTJOa6AsaLnvlTJ/KCItXJ1Iq8LUQNn1o830Y0 qUakoVSSiJDVM5s2YlGb0bg7P8OPl4QMou+I X-Google-Smtp-Source: APXvYqxda3yYoKKnpk5jLs7PHS640+nhsekytgKzEi4NCxPWeWq3wLVCa4LnWHgokhEbNvZvtnzAJQ== X-Received: by 2002:a62:ed16:: with SMTP id u22mr71203026pfh.47.1555271580833; Sun, 14 Apr 2019 12:53:00 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([50.236.184.206]) by smtp.gmail.com with ESMTPSA id j16sm62388977pfi.58.2019.04.14.12.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Apr 2019 12:53:00 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Andrew Fish , Leif Lindholm , Star Zeng , Eric Dong , Ruiyu Ni , Liming Gao , Jaben Carsey , Steven Shi , Jian J Wang , Hao Wu Subject: [PATCH v6 7/7] MdeModulePkg/DxeCore: remove explicit EBC handling Date: Sun, 14 Apr 2019 12:52:33 -0700 Message-Id: <20190414195233.30045-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190414195233.30045-1-ard.biesheuvel@linaro.org> References: <20190414195233.30045-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. Signed-off-by: Ard Biesheuvel Reviewed-by: Michael D Kinney --- 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 57330636b5f3..d5e890dd5312 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"}, @@ -774,51 +770,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), @@ -1008,13 +968,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