| 1 |
/* |
| 2 |
* Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <arch.h> |
| 8 |
#include <asm_macros.S> |
| 9 |
#include <common/debug.h> |
| 10 |
|
| 11 |
.globl el2_panic |
| 12 |
|
| 13 |
/*********************************************************** |
| 14 |
* The common implementation of el3_panic for all BL stages |
| 15 |
***********************************************************/ |
| 16 |
|
| 17 |
.section .rodata.panic_str, "aS" |
| 18 |
panic_msg: .asciz "PANIC at PC : 0x" |
| 19 |
|
| 20 |
/* |
| 21 |
* el2_panic will be redefined by the |
| 22 |
* crash reporting mechanism (if enabled) |
| 23 |
*/ |
| 24 |
el2_panic: |
| 25 |
mov x6, x30 |
| 26 |
bl plat_crash_console_init |
| 27 |
|
| 28 |
/* Check if the console is initialized */ |
| 29 |
cbz x0, _panic_handler |
| 30 |
|
| 31 |
/* The console is initialized */ |
| 32 |
adr x4, panic_msg |
| 33 |
bl asm_print_str |
| 34 |
mov x4, x6 |
| 35 |
|
| 36 |
/* The panic location is lr -4 */ |
| 37 |
sub x4, x4, #4 |
| 38 |
bl asm_print_hex |
| 39 |
|
| 40 |
bl plat_crash_console_flush |
| 41 |
|
| 42 |
_panic_handler: |
| 43 |
/* Pass to plat_panic_handler the address from where el2_panic was |
| 44 |
* called, not the address of the call from el2_panic. |
| 45 |
*/ |
| 46 |
mov x30, x6 |
| 47 |
b plat_panic_handler |