From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
Andrew Fish <afish@apple.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
"Zeng, Star" <star.zeng@intel.com>,
"Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>,
"Gao, Liming" <liming.gao@intel.com>,
"Carsey, Jaben" <jaben.carsey@intel.com>,
"Shi, Steven" <steven.shi@intel.com>,
"Wang, Jian J" <jian.j.wang@intel.com>
Subject: Re: [PATCH v6 1/7] MdeModulePkg: introduce PE/COFF image emulator protocol
Date: Mon, 15 Apr 2019 01:23:11 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C8BEA6F@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190414195233.30045-2-ard.biesheuvel@linaro.org>
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, April 15, 2019 3:52 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel; Kinney, Michael D; Andrew Fish; Leif Lindholm; Zeng, Star;
> Dong, Eric; Ni, Ray; Gao, Liming; Carsey, Jaben; Shi, Steven; Wang, Jian J; Wu,
> Hao A
> Subject: [PATCH v6 1/7] MdeModulePkg: introduce PE/COFF image emulator
> protocol
>
> Introduce a protocol that can be invoked by the image loading services
> to execute foreign architecture PE/COFF images via an emulator.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h | 107
> ++++++++++++++++++++
> MdeModulePkg/MdeModulePkg.dec | 4 +
> 2 files changed, 111 insertions(+)
>
> diff --git a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
> b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
> new file mode 100644
> index 000000000000..1ca302440e4a
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
> @@ -0,0 +1,107 @@
> +/** @file
> + Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR>
> +
> + This program and the accompanying materials are licensed and made
> available
> + under the terms and conditions of the BSD License which accompanies this
> + distribution. The full text of the license may be found at
> + http://opensource.org/licenses/bsd-license.php
> +
> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#ifndef PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
> +#define PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
Hello Ard,
Sorry for the delayed response.
Could you help to use:
_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
here to please the Ecc checker when you push the series?
Best Regards,
Hao Wu
> +
> +#define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \
> + { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA,
> 0x97 } }
> +
> +typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
> EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
> +
> +/**
> + Check whether the emulator supports executing a certain PE/COFF image
> +
> + @param[in] This This pointer for
> EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
> + structure
> + @param[in] ImageType Whether the image is an application, a boot time
> + driver or a runtime driver.
> + @param[in] DevicePath Path to device where the image originated
> + (e.g., a PCI option ROM)
> +
> + @retval TRUE The image is supported by the emulator
> + @retval FALSE The image is not supported by the emulator.
> +**/
> +typedef
> +BOOLEAN
> +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED) (
> + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
> + IN UINT16 ImageType,
> + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL
> + );
> +
> +/**
> + Register a supported PE/COFF image with the emulator. After this call
> + completes successfully, the PE/COFF image may be started as usual, and
> + it is the responsibility of the emulator implementation that any branch
> + into the code section of the image (including returns from functions called
> + from the foreign code) is executed as if it were running on the machine
> + type it was built for.
> +
> + @param[in] This This pointer for
> + EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
> + @param[in] ImageBase The base address in memory of the PE/COFF
> image
> + @param[in] ImageSize The size in memory of the PE/COFF image
> + @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed
> by
> + reference so that the emulator may modify it.
> +
> + @retval EFI_SUCCESS The image was registered with the emulator and
> + can be started as usual.
> + @retval other The image could not be registered.
> +
> + If the PE/COFF machine type or image type are not supported by the
> emulator,
> + then ASSERT().
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE) (
> + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
> + IN EFI_PHYSICAL_ADDRESS ImageBase,
> + IN UINT64 ImageSize,
> + IN OUT EFI_IMAGE_ENTRY_POINT *EntryPoint
> + );
> +
> +/**
> + Unregister a PE/COFF image that has been registered with the emulator.
> + This should be done before the image is unloaded from memory.
> +
> + @param[in] This This pointer for
> EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
> + structure
> + @param[in] ImageBase The base address in memory of the PE/COFF
> image
> +
> + @retval EFI_SUCCESS The image was unregistered with the emulator.
> + @retval other Image could not be unloaded.
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE) (
> + IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,
> + IN EFI_PHYSICAL_ADDRESS ImageBase
> + );
> +
> +#define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1
> +
> +typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
> + EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED
> IsImageSupported;
> + EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage;
> + EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE
> UnregisterImage;
> +
> + // Protocol version implemented by the emulator
> + UINT32 Version;
> + // The machine type implemented by the emulator
> + UINT16 MachineType;
> +} EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
> +
> +extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid;
> +
> +#endif
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index a2130bc43991..c2b4e7f69367 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -629,6 +629,10 @@
>
> ## Include/Protocol/AtaAtapiPolicy.h
> gEdkiiAtaAtapiPolicyProtocolGuid = { 0xe59cd769, 0x5083, 0x4f26,{ 0x90,
> 0x94, 0x6c, 0x91, 0x9f, 0x91, 0x6c, 0x4e } }
> +
> + ## Include/Protocol/PeCoffImageEmulator.h
> + gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
> +
> #
> # [Error.gEfiMdeModulePkgTokenSpaceGuid]
> # 0x80000001 | Invalid value provided.
> --
> 2.17.1
next prev parent reply other threads:[~2019-04-15 1:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-14 19:52 [PATCH v6 0/7] MdeModulePkg: add support for dispatching foreign arch PE/COFF images Ard Biesheuvel
2019-04-14 19:52 ` [PATCH v6 1/7] MdeModulePkg: introduce PE/COFF image emulator protocol Ard Biesheuvel
2019-04-15 1:23 ` Wu, Hao A [this message]
2019-04-15 9:02 ` Leif Lindholm
2019-04-15 14:22 ` [edk2-devel] " Liming Gao
2019-04-15 15:53 ` Michael D Kinney
2019-04-15 21:52 ` Michael D Kinney
2019-04-14 19:52 ` [PATCH v6 2/7] MdeModulePkg/DxeCore: invoke the emulator protocol for foreign images Ard Biesheuvel
2019-04-15 1:23 ` Wu, Hao A
2019-04-14 19:52 ` [PATCH v6 3/7] MdeModulePkg/PciBusDxe: dispatch option ROMs for foreign architectures Ard Biesheuvel
2019-04-15 20:23 ` [edk2-devel] " Ni, Ray
2019-04-16 6:02 ` Gary Lin
2019-04-16 16:20 ` Ard Biesheuvel
2019-04-14 19:52 ` [PATCH v6 4/7] MdeModulePkg/UefiBootManagerLib: allow foreign Driver#### images Ard Biesheuvel
2019-04-15 20:22 ` [edk2-devel] " Ni, Ray
2019-04-14 19:52 ` [PATCH v6 5/7] MdeModulePkg/EbcDxe: implement the PE/COFF emulator protocol Ard Biesheuvel
2019-04-14 19:52 ` [PATCH v6 6/7] MdePkg/UefiBaseType.h: treat EBC as a non-native machine type Ard Biesheuvel
2019-04-14 19:52 ` [PATCH v6 7/7] MdeModulePkg/DxeCore: remove explicit EBC handling Ard Biesheuvel
2019-04-15 1:25 ` [PATCH v6 0/7] MdeModulePkg: add support for dispatching foreign arch PE/COFF images Wu, Hao A
2019-04-15 2:04 ` [edk2-devel] " Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A093C8BEA6F@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox