1 // SPDX-License-Identifier: GPL-2.0+
3 * efi_selftest_miniapp_return
5 * Copyright (c) 2019 Heinrich Schuchardt
7 * This EFI application triggers an exception.
12 #include <host_arch.h>
15 * Entry point of the EFI application.
17 * @handle handle of the loaded image
18 * @systable system table
21 efi_status_t EFIAPI efi_main(efi_handle_t handle,
22 struct efi_system_table *systable)
24 struct efi_simple_text_output_protocol *con_out = systable->con_out;
26 con_out->output_string(con_out,
27 u"EFI application triggers exception.\n");
29 #if defined(CONFIG_ARM)
31 * 0xe7f...f. is undefined in ARM mode
32 * 0xde.. is undefined in Thumb mode
34 asm volatile (".word 0xe7f7defb\n");
35 #elif defined(CONFIG_RISCV)
36 asm volatile (".word 0xffffffff\n");
37 #elif defined(CONFIG_X86)
38 asm volatile (".word 0xffff\n");
39 #elif defined(CONFIG_SANDBOX)
40 #if (HOST_ARCH == HOST_ARCH_ARM || HOST_ARCH == HOST_ARCH_AARCH64)
41 asm volatile (".word 0xe7f7defb\n");
42 #elif (HOST_ARCH == HOST_ARCH_RISCV32 || HOST_ARCH == HOST_ARCH_RISCV64)
43 asm volatile (".word 0xffffffff\n");
44 #elif (HOST_ARCH == HOST_ARCH_X86 || HOST_ARCH == HOST_ARCH_X86_64)
45 asm volatile (".word 0xffff\n");
48 con_out->output_string(con_out, u"Exception not triggered.\n");