2019-08-27 06:16:08 +00:00
|
|
|
// 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>
|
2022-09-02 00:46:37 +00:00
|
|
|
#include <host_arch.h>
|
2019-08-27 06:16:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Entry point of the EFI application.
|
|
|
|
*
|
|
|
|
* @handle handle of the loaded image
|
|
|
|
* @systable system table
|
2022-01-19 17:05:50 +00:00
|
|
|
* Return: status code
|
2019-08-27 06:16:08 +00:00
|
|
|
*/
|
|
|
|
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,
|
2022-01-23 19:55:12 +00:00
|
|
|
u"EFI application triggers exception.\n");
|
2019-08-27 06:16:08 +00:00
|
|
|
|
|
|
|
#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");
|
2022-09-02 00:46:37 +00:00
|
|
|
#elif defined(CONFIG_X86)
|
|
|
|
asm volatile (".word 0xffff\n");
|
2020-11-11 23:29:58 +00:00
|
|
|
#elif defined(CONFIG_SANDBOX)
|
2022-09-02 00:46:37 +00:00
|
|
|
#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)
|
2020-11-11 23:29:58 +00:00
|
|
|
asm volatile (".word 0xffffffff\n");
|
2022-09-02 00:46:37 +00:00
|
|
|
#elif (HOST_ARCH == HOST_ARCH_X86 || HOST_ARCH == HOST_ARCH_X86_64)
|
2019-08-27 06:16:08 +00:00
|
|
|
asm volatile (".word 0xffff\n");
|
2022-09-02 00:46:37 +00:00
|
|
|
#endif
|
2019-08-27 06:16:08 +00:00
|
|
|
#endif
|
2022-01-23 19:55:12 +00:00
|
|
|
con_out->output_string(con_out, u"Exception not triggered.\n");
|
2019-08-27 06:16:08 +00:00
|
|
|
return EFI_ABORTED;
|
|
|
|
}
|