|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
commit 2a0add9e32e84727e7807bf2a38e3433103c2155
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Mar 6 15:20:39 2025 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Mar 6 15:20:39 2025 +0100
Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
This reverts commit eaed0d185ab8b73cd18ac2830878520b3011f5ab. It breaks the
build with old Clang (3.8).
---
xen/common/efi/boot.c | 58 +++++++++++++++-----------------------------
xen/common/efi/efi-common.mk | 1 -
2 files changed, 19 insertions(+), 40 deletions(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 143b5681ba..efbec00af9 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -287,53 +287,33 @@ static bool __init match_guid(const EFI_GUID *guid1,
const EFI_GUID *guid2)
/* generic routine for printing error messages */
static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
{
+ static const CHAR16* const ErrCodeToStr[] __initconstrel = {
+ [~EFI_ERROR_MASK & EFI_NOT_FOUND] = L"Not found",
+ [~EFI_ERROR_MASK & EFI_NO_MEDIA] = L"The device has no
media",
+ [~EFI_ERROR_MASK & EFI_MEDIA_CHANGED] = L"Media changed",
+ [~EFI_ERROR_MASK & EFI_DEVICE_ERROR] = L"Device error",
+ [~EFI_ERROR_MASK & EFI_VOLUME_CORRUPTED] = L"Volume corrupted",
+ [~EFI_ERROR_MASK & EFI_ACCESS_DENIED] = L"Access denied",
+ [~EFI_ERROR_MASK & EFI_OUT_OF_RESOURCES] = L"Out of resources",
+ [~EFI_ERROR_MASK & EFI_VOLUME_FULL] = L"Volume is full",
+ [~EFI_ERROR_MASK & EFI_SECURITY_VIOLATION] = L"Security violation",
+ [~EFI_ERROR_MASK & EFI_CRC_ERROR] = L"CRC error",
+ [~EFI_ERROR_MASK & EFI_COMPROMISED_DATA] = L"Compromised data",
+ [~EFI_ERROR_MASK & EFI_BUFFER_TOO_SMALL] = L"Buffer too small",
+ };
+ EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
+
StdOut = StdErr;
PrintErr(mesg);
PrintErr(L": ");
- switch (ErrCode)
+ if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
+ mesg = ErrCodeToStr[ErrIdx];
+ else
{
- case EFI_NOT_FOUND:
- mesg = L"Not found";
- break;
- case EFI_NO_MEDIA:
- mesg = L"The device has no media";
- break;
- case EFI_MEDIA_CHANGED:
- mesg = L"Media changed";
- break;
- case EFI_DEVICE_ERROR:
- mesg = L"Device error";
- break;
- case EFI_VOLUME_CORRUPTED:
- mesg = L"Volume corrupted";
- break;
- case EFI_ACCESS_DENIED:
- mesg = L"Access denied";
- break;
- case EFI_OUT_OF_RESOURCES:
- mesg = L"Out of resources";
- break;
- case EFI_VOLUME_FULL:
- mesg = L"Volume is full";
- break;
- case EFI_SECURITY_VIOLATION:
- mesg = L"Security violation";
- break;
- case EFI_CRC_ERROR:
- mesg = L"CRC error";
- break;
- case EFI_COMPROMISED_DATA:
- mesg = L"Compromised data";
- break;
- case EFI_BUFFER_TOO_SMALL:
- mesg = L"Buffer too small";
- break;
- default:
PrintErr(L"ErrCode: ");
DisplayUint(ErrCode, 0);
mesg = NULL;
- break;
}
blexit(mesg);
}
diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
index 06b1c19674..23cafcf20c 100644
--- a/xen/common/efi/efi-common.mk
+++ b/xen/common/efi/efi-common.mk
@@ -2,7 +2,6 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
EFIOBJ-$(CONFIG_COMPAT) += compat.o
CFLAGS-y += -fshort-wchar
-CFLAGS-y += -fno-jump-tables
CFLAGS-y += -iquote $(srctree)/common/efi
CFLAGS-y += -iquote $(srcdir)
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |