summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Li <lichao@loongson.cn>2024-12-10 19:23:23 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-12 04:57:03 +0000
commit03783393e16d776ca29d3f13b9cab1e1c3a5d11b (patch)
treefac3ac2dde25793fb9fb230fea4513d2502843c5
parent25ce25ecce47b54756832d278c30036f9c57b77d (diff)
downloadedk2-03783393e16d776ca29d3f13b9cab1e1c3a5d11b.tar.gz
MdePkg: Allows loading X64 and ARM64 OPROM images on LoongArch64
Enable foreign images loading on LoongArch64 if the EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL is present. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Co-Authored-by: Dongyan Qian <qiandongyan@loongson.cn>
-rw-r--r--MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c
index 417096f334..3a7c820857 100644
--- a/MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c
+++ b/MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c
@@ -104,7 +104,15 @@ PeCoffLoaderImageFormatSupported (
IN UINT16 Machine
)
{
- if (Machine == IMAGE_FILE_MACHINE_LOONGARCH64) {
+ /*
+ * ARM64 and X64 may allow such foreign images to be used when
+ * a driver implementing EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL is
+ * present.
+ */
+ if ((Machine == IMAGE_FILE_MACHINE_LOONGARCH64) ||
+ (Machine == IMAGE_FILE_MACHINE_ARM64) ||
+ (Machine == IMAGE_FILE_MACHINE_X64))
+ {
return TRUE;
}