aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-09-02 02:46:37 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-09-03 08:16:09 +0200
commit2b7a6e013fe9c4f8c8ed29d79f6757f8c482dc72 (patch)
tree811e6f97a0eec9a7a0ea766fa797523c86791f9b
parente053a144ca85ffbc8649bc3e170c408b42f92536 (diff)
downloadu-boot-2b7a6e013fe9c4f8c8ed29d79f6757f8c482dc72.zip
u-boot-2b7a6e013fe9c4f8c8ed29d79f6757f8c482dc72.tar.gz
u-boot-2b7a6e013fe9c4f8c8ed29d79f6757f8c482dc72.tar.bz2
efi_selftest: on sandbox use host specific assembly
The selftest checking the handling of exceptions in UEFI binaries is using assembly to provide an undefined instruction. On the sandbox the correct form of the instruction depends on the host architecture. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r--lib/efi_selftest/efi_selftest_miniapp_exception.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c
index 79f9a67..a9ad381 100644
--- a/lib/efi_selftest/efi_selftest_miniapp_exception.c
+++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <efi_api.h>
+#include <host_arch.h>
/*
* Entry point of the EFI application.
@@ -33,11 +34,17 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
asm volatile (".word 0xe7f7defb\n");
#elif defined(CONFIG_RISCV)
asm volatile (".word 0xffffffff\n");
+#elif defined(CONFIG_X86)
+ asm volatile (".word 0xffff\n");
#elif defined(CONFIG_SANDBOX)
+#if (HOST_ARCH == HOST_ARCH_ARM || HOST_ARCH == HOST_ARCH_AARCH64)
+ asm volatile (".word 0xe7f7defb\n");
+#elif (HOST_ARCH == HOST_ARCH_RISCV32 || HOST_ARCH == HOST_ARCH_RISCV64)
asm volatile (".word 0xffffffff\n");
-#elif defined(CONFIG_X86)
+#elif (HOST_ARCH == HOST_ARCH_X86 || HOST_ARCH == HOST_ARCH_X86_64)
asm volatile (".word 0xffff\n");
#endif
+#endif
con_out->output_string(con_out, u"Exception not triggered.\n");
return EFI_ABORTED;
}