aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c')
-rw-r--r--roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c b/roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c
new file mode 100644
index 000000000..59b7e5100
--- /dev/null
+++ b/roms/u-boot/lib/efi_selftest/efi_selftest_miniapp_exception.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * efi_selftest_miniapp_return
+ *
+ * Copyright (c) 2019 Heinrich Schuchardt
+ *
+ * This EFI application triggers an exception.
+ */
+
+#include <common.h>
+#include <efi_api.h>
+
+/*
+ * Entry point of the EFI application.
+ *
+ * @handle handle of the loaded image
+ * @systable system table
+ * @return status code
+ */
+efi_status_t EFIAPI efi_main(efi_handle_t handle,
+ struct efi_system_table *systable)
+{
+ struct efi_simple_text_output_protocol *con_out = systable->con_out;
+
+ con_out->output_string(con_out,
+ L"EFI application triggers exception.\n");
+
+#if defined(CONFIG_ARM)
+ /*
+ * 0xe7f...f. is undefined in ARM mode
+ * 0xde.. is undefined in Thumb mode
+ */
+ asm volatile (".word 0xe7f7defb\n");
+#elif defined(CONFIG_RISCV)
+ asm volatile (".word 0xffffffff\n");
+#elif defined(CONFIG_SANDBOX)
+ asm volatile (".word 0xffffffff\n");
+#elif defined(CONFIG_X86)
+ asm volatile (".word 0xffff\n");
+#endif
+ con_out->output_string(con_out, L"Exception not triggered.\n");
+ return EFI_ABORTED;
+}