From patchwork Thu Sep 20 23:01:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 147174 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp100223ljw; Thu, 20 Sep 2018 16:02:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbvP4h5FbMIDyrppAnao635YFziV6Di2tt9J2xxVQI697d+//GPcz6ehx79FSa86qznmo22 X-Received: by 2002:a62:9349:: with SMTP id b70-v6mr43883468pfe.193.1537484534985; Thu, 20 Sep 2018 16:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537484534; cv=none; d=google.com; s=arc-20160816; b=YSC22rzAKypwsciy/tzooj5cZ+Z/sPT23L31ZAkHxI/OsGjsOualwH1a4P1xegI4Pm L87JiBUY1xMoNp9GZVEnpRcOZRZP8ldlX0JEDeUQiVE78wVTnjAB3cQIdYV0s4w6yiM5 0wqOUPqlG2X5anz/tFPvq88ayXzIl1TMC9JYN6bydJd2+IyxwWK6EXIc1hlZENMug8rJ EPSwc8qQh4Q02alBbJMoBYJywfZws6bkzbLFTF+cZze+vmC6QHaVZwR9mwZHP2p32LsF RflsGJhseMy2/SB3L+/wRaFAQPGOAvzRwRz5mJfTRMkuLWLj0KYh5Owj9VrhdmRuUuwW aCoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=dkzmrFAd6KCZTcp0Ti63S5GwlrAsmXXw/NNb1sdj8Vc=; b=pfFjfMG4knGJvY7TpSrY+d0sNlRq/TvQ1cRFkFkDWoHgdIu8zi+FT3ajLCDTaUUDXA E9U89Nhownw/oQiBwG1cxfnjWH/5o5GWxd555EtcwZ5oVq8Zcc8I93ioX3NBcRlYmfR+ UW0rdxgQE3MgWW8RX1oab4UD342nNH+G6r+VpAkrWSZQYGyy4LP4jkSHVpvxQffV4vmB JE7Y17fowHfi+Izwp0UrmBikJC/i+COExrHkCjtS3lAtf3Vh0y6TIvAhaQYZMg183fH2 kW0ypzJi0uZGOh2rqXWEz5EQAmqP0OdoP9JWlMJqghzpwyyHVOuMyFzkSDSRJYs2nbkp u2Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GTOGs6tx; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id l12-v6si6703516pgj.76.2018.09.20.16.02.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 16:02:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GTOGs6tx; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5AC552114A6B8; Thu, 20 Sep 2018 16:02:01 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DDB5B2114A6B8 for ; Thu, 20 Sep 2018 16:01:59 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id k19-v6so5063467pfi.1 for ; Thu, 20 Sep 2018 16:01:59 -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=v73A6xh5lqYSrw/3CfUVlKZwqT6yWqMFc31EjjLPYjs=; b=GTOGs6tx6ouC6XrrPh8aSu/duDJPflMHCqoJ8fBZIlFt7oyvga6ZraYsMkvcbJSBVE nXgARLyNmQw+YKqzxb3iFxBmTGiShqOHRvygq52hf5lkDL+f6/3DcxAvyhPeTLc5rbFq oevZKmBOysJmvW8Azju21pTKGaE6vAnSuALXE= 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=v73A6xh5lqYSrw/3CfUVlKZwqT6yWqMFc31EjjLPYjs=; b=qU58pS9ixCFDJqIIkXgBB+Lwc5zd5JDBs/Npw2dH+5Asw4tLHdWB6LSAemvbJgUCaa GvBr83qzrjZRlBmcDRhoTdQcSV8tgexObFvVaDUeGpgrSk3YbAoFH9IqxNf3vxYTTWMi tfWS2XSH3JfXxHgPLqS1vwERyd2ZmJm7wpWspDwAT0xc7RUXMogWFUyZ4o+6tUFiR3KJ ZGSKZV0Pqnck0Q8EyhVDrndpo+uyS5Nu3gM2hAbAPw+BihTwfYDUfzs6z+oE9QK0ahYn BDV8UBNMl2ZNsDqdTG+fb7W7OXbgOC5UxeyoLlFBVaguZt1aCyEaNDsQxGrHorE4+ZCk qFRQ== X-Gm-Message-State: APzg51DII3XAX6hPbakka1J/K/HbzxuFBxlmRKIxeak8HIjExjmR+8Gn uDBic2BalxeSutV8XoIQAcJrrocFDyk= X-Received: by 2002:a63:ec43:: with SMTP id r3-v6mr32624366pgj.295.1537484519320; Thu, 20 Sep 2018 16:01:59 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id p4-v6sm37507823pfd.65.2018.09.20.16.01.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 16:01:58 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 20 Sep 2018 16:01:45 -0700 Message-Id: <20180920230145.7565-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180920230145.7565-1-ard.biesheuvel@linaro.org> References: <20180920230145.7565-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 7/7] MdeModulePkg/DxeCore: remove explicit EBC handling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Vincent Zimmer , Eric Dong , Andrew Fish , Jaben Carsey , Brian Richardson , Liming Gao , Michael D Kinney , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index ff2418c5ae5e..c473006813fe 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 @@ -228,8 +227,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 63e650ee7c27..a969b869b331 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -161,7 +161,6 @@ gEfiLoadedImageProtocolGuid ## PRODUCES gEfiLoadedImageDevicePathProtocolGuid ## PRODUCES gEfiHiiPackageListProtocolGuid ## SOMETIMES_PRODUCES - gEfiEbcProtocolGuid ## SOMETIMES_CONSUMES gEfiSmmBase2ProtocolGuid ## SOMETIMES_CONSUMES gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES gEdkiiPeCoffImageEmulatorProtocolGuid ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index dd987f7fcea7..53d526fddc7d 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -74,7 +74,6 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage = { NULL, // JumpBuffer NULL, // JumpContext 0, // Machine - NULL, // Ebc NULL, // PeCoffEmu NULL, // RuntimeData NULL // LoadedImageDevicePath @@ -91,9 +90,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"}, @@ -742,51 +738,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), @@ -976,13 +936,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.