diff options
author | Tom Rini <trini@konsulko.com> | 2019-08-29 07:26:42 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-08-29 07:26:42 -0400 |
commit | 877294b56a52f1cb60bbfa7e4722fcc33451f7b2 (patch) | |
tree | b71edf846267981c9c66c9ba18b56204c1e27ecc /lib/efi_selftest/efi_selftest_miniapp_exception.c | |
parent | 25f32e0dffb17292dc17cd0f6694dd5e91c405a2 (diff) | |
parent | 53c701720c3d5e5ae107454ea9b9f680bc399006 (diff) |
Merge tag 'efi-2019-10-rc4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for v2019.10-rc4
Enable the unit test for UEFI runtime service Exit() on x86_64.
Use as standalone UEFI binary for testing the handling of exceptions.
Diffstat (limited to 'lib/efi_selftest/efi_selftest_miniapp_exception.c')
-rw-r--r-- | lib/efi_selftest/efi_selftest_miniapp_exception.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c new file mode 100644 index 0000000000..63c63d75f1 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c @@ -0,0 +1,41 @@ +// 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_X86) + asm volatile (".word 0xffff\n"); +#endif + con_out->output_string(con_out, L"Exception not triggered.\n"); + return EFI_ABORTED; +} |