Heinrich Schuchardt | cafccfd | 2019-08-27 08:16:08 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * efi_selftest_miniapp_return |
| 4 | * |
| 5 | * Copyright (c) 2019 Heinrich Schuchardt |
| 6 | * |
| 7 | * This EFI application triggers an exception. |
| 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <efi_api.h> |
| 12 | |
| 13 | /* |
| 14 | * Entry point of the EFI application. |
| 15 | * |
| 16 | * @handle handle of the loaded image |
| 17 | * @systable system table |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 18 | * Return: status code |
Heinrich Schuchardt | cafccfd | 2019-08-27 08:16:08 +0200 | [diff] [blame] | 19 | */ |
| 20 | efi_status_t EFIAPI efi_main(efi_handle_t handle, |
| 21 | struct efi_system_table *systable) |
| 22 | { |
| 23 | struct efi_simple_text_output_protocol *con_out = systable->con_out; |
| 24 | |
| 25 | con_out->output_string(con_out, |
Simon Glass | 9097537 | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 26 | u"EFI application triggers exception.\n"); |
Heinrich Schuchardt | cafccfd | 2019-08-27 08:16:08 +0200 | [diff] [blame] | 27 | |
| 28 | #if defined(CONFIG_ARM) |
| 29 | /* |
| 30 | * 0xe7f...f. is undefined in ARM mode |
| 31 | * 0xde.. is undefined in Thumb mode |
| 32 | */ |
| 33 | asm volatile (".word 0xe7f7defb\n"); |
| 34 | #elif defined(CONFIG_RISCV) |
| 35 | asm volatile (".word 0xffffffff\n"); |
Heinrich Schuchardt | a8466ad | 2020-11-12 00:29:58 +0100 | [diff] [blame] | 36 | #elif defined(CONFIG_SANDBOX) |
| 37 | asm volatile (".word 0xffffffff\n"); |
Heinrich Schuchardt | cafccfd | 2019-08-27 08:16:08 +0200 | [diff] [blame] | 38 | #elif defined(CONFIG_X86) |
| 39 | asm volatile (".word 0xffff\n"); |
| 40 | #endif |
Simon Glass | 9097537 | 2022-01-23 12:55:12 -0700 | [diff] [blame] | 41 | con_out->output_string(con_out, u"Exception not triggered.\n"); |
Heinrich Schuchardt | cafccfd | 2019-08-27 08:16:08 +0200 | [diff] [blame] | 42 | return EFI_ABORTED; |
| 43 | } |