Blame view

lib/efi_selftest/efi_selftest_miniapp_exception.c 972 Bytes
53c701720   Heinrich Schuchardt   efi_selftest: use...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  // 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.
  ");
  
  #if defined(CONFIG_ARM)
  	/*
  	 * 0xe7f...f.	is undefined in ARM mode
  	 * 0xde..	is undefined in Thumb mode
  	 */
  	asm volatile (".word 0xe7f7defb
  ");
  #elif defined(CONFIG_RISCV)
  	asm volatile (".word 0xffffffff
  ");
  #elif defined(CONFIG_X86)
  	asm volatile (".word 0xffff
  ");
  #endif
  	con_out->output_string(con_out, L"Exception not triggered.
  ");
  	return EFI_ABORTED;
  }