source: rtems/bsps/sparc/shared/start/bsp_fatal_halt.c @ 8b65b574

Last change on this file since 8b65b574 was 8b65b574, checked in by Sebastian Huber <sebastian.huber@…>, on 07/28/21 at 12:41:32

score: Canonicalize _CPU_Fatal_halt()

Move _CPU_Fatal_halt() declaration to <rtems/score/cpuimpl.h> and make sure it
is a proper declaration of a function which does not return. Fix the type of
the error code. If necessary, add the implementation to cpu.c. Implementing
_CPU_Fatal_halt() as a function makes it possible to wrap this function for
example to fully test _Terminate().

  • Property mode set to 100644
File size: 845 bytes
Line 
1/**
2 * @file
3 * @ingroup RTEMSBSPsSPARCShared
4 * @brief ERC32/LEON2 BSP Fatal_halt handler.
5 *
6 *  COPYRIGHT (c) 2014.
7 *  Aeroflex Gaisler AB.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 */
13
14#include <bsp.h>
15#include <rtems/score/cpuimpl.h>
16
17void _CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr error )
18{
19#ifdef BSP_POWER_DOWN_AT_FATAL_HALT
20  /* Spin CPU on fatal error exit */
21  uint32_t level = sparc_disable_interrupts();
22
23  __asm__ volatile ( "mov  %0, %%g1 " : "=r" (level) : "0" (level) );
24
25  while (1) ; /* loop forever */
26#else
27  /*
28   * Return to debugger, simulator, hypervisor or similar by exiting
29   * with an error code. g1=1, g2=FATAL_SOURCE, G3=error-code.
30   */
31  sparc_syscall_exit(source, error);
32#endif
33}
Note: See TracBrowser for help on using the repository browser.