Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 1 | /* |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 2 | * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 6 | |
| 7 | #include <plat_macros.S> |
| 8 | #include <platform_def.h> |
| 9 | |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 10 | #include <arch.h> |
| 11 | #include <asm_macros.S> |
| 12 | #include <context.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | #include <lib/el3_runtime/cpu_data.h> |
| 14 | #include <lib/utils_def.h> |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 15 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 16 | .globl report_unhandled_exception |
| 17 | .globl report_unhandled_interrupt |
| 18 | .globl el3_panic |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 19 | |
Andrew Thoelke | 385f4d4 | 2014-06-03 11:50:53 +0100 | [diff] [blame] | 20 | #if CRASH_REPORTING |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 21 | |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 22 | /* ------------------------------------------------------ |
| 23 | * The below section deals with dumping the system state |
| 24 | * when an unhandled exception is taken in EL3. |
| 25 | * The layout and the names of the registers which will |
| 26 | * be dumped during a unhandled exception is given below. |
| 27 | * ------------------------------------------------------ |
| 28 | */ |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 29 | .section .rodata.crash_prints, "aS" |
| 30 | print_spacer: |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 31 | .asciz " = 0x" |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 32 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 33 | gp_regs: |
| 34 | .asciz "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",\ |
| 35 | "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",\ |
| 36 | "x16", "x17", "x18", "x19", "x20", "x21", "x22",\ |
| 37 | "x23", "x24", "x25", "x26", "x27", "x28", "x29", "" |
| 38 | el3_sys_regs: |
| 39 | .asciz "scr_el3", "sctlr_el3", "cptr_el3", "tcr_el3",\ |
| 40 | "daif", "mair_el3", "spsr_el3", "elr_el3", "ttbr0_el3",\ |
| 41 | "esr_el3", "far_el3", "" |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 42 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 43 | non_el3_sys_regs: |
| 44 | .asciz "spsr_el1", "elr_el1", "spsr_abt", "spsr_und",\ |
| 45 | "spsr_irq", "spsr_fiq", "sctlr_el1", "actlr_el1", "cpacr_el1",\ |
| 46 | "csselr_el1", "sp_el1", "esr_el1", "ttbr0_el1", "ttbr1_el1",\ |
| 47 | "mair_el1", "amair_el1", "tcr_el1", "tpidr_el1", "tpidr_el0",\ |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 48 | "tpidrro_el0", "par_el1", "mpidr_el1", "afsr0_el1", "afsr1_el1",\ |
| 49 | "contextidr_el1", "vbar_el1", "cntp_ctl_el0", "cntp_cval_el0",\ |
| 50 | "cntv_ctl_el0", "cntv_cval_el0", "cntkctl_el1", "sp_el0", "isr_el1", "" |
| 51 | |
| 52 | #if CTX_INCLUDE_AARCH32_REGS |
| 53 | aarch32_regs: |
| 54 | .asciz "dacr32_el2", "ifsr32_el2", "" |
| 55 | #endif /* CTX_INCLUDE_AARCH32_REGS */ |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 56 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 57 | panic_msg: |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 58 | .asciz "PANIC in EL3.\nx30" |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 59 | excpt_msg: |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 60 | .asciz "Unhandled Exception in EL3.\nx30" |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 61 | intr_excpt_msg: |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 62 | .asciz "Unhandled Interrupt Exception in EL3.\nx30" |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 63 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 64 | /* |
| 65 | * Helper function to print newline to console. |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 66 | */ |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 67 | func print_newline |
| 68 | mov x0, '\n' |
| 69 | b plat_crash_console_putc |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 70 | endfunc print_newline |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 71 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 72 | /* |
| 73 | * Helper function to print from crash buf. |
| 74 | * The print loop is controlled by the buf size and |
| 75 | * ascii reg name list which is passed in x6. The |
| 76 | * function returns the crash buf address in x0. |
| 77 | * Clobbers : x0 - x7, sp |
| 78 | */ |
| 79 | func size_controlled_print |
| 80 | /* Save the lr */ |
| 81 | mov sp, x30 |
| 82 | /* load the crash buf address */ |
| 83 | mrs x7, tpidr_el3 |
| 84 | test_size_list: |
| 85 | /* Calculate x5 always as it will be clobbered by asm_print_hex */ |
| 86 | mrs x5, tpidr_el3 |
| 87 | add x5, x5, #CPU_DATA_CRASH_BUF_SIZE |
| 88 | /* Test whether we have reached end of crash buf */ |
| 89 | cmp x7, x5 |
| 90 | b.eq exit_size_print |
| 91 | ldrb w4, [x6] |
| 92 | /* Test whether we are at end of list */ |
| 93 | cbz w4, exit_size_print |
| 94 | mov x4, x6 |
| 95 | /* asm_print_str updates x4 to point to next entry in list */ |
| 96 | bl asm_print_str |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 97 | /* x0 = number of symbols printed + 1 */ |
| 98 | sub x0, x4, x6 |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 99 | /* update x6 with the updated list pointer */ |
| 100 | mov x6, x4 |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 101 | bl print_alignment |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 102 | ldr x4, [x7], #REGSZ |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 103 | bl asm_print_hex |
| 104 | bl print_newline |
| 105 | b test_size_list |
| 106 | exit_size_print: |
| 107 | mov x30, sp |
| 108 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 109 | endfunc size_controlled_print |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 110 | |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 111 | /* ----------------------------------------------------- |
| 112 | * This function calculates and prints required number |
| 113 | * of space characters followed by "= 0x", based on the |
| 114 | * length of ascii register name. |
| 115 | * x0: length of ascii register name + 1 |
| 116 | * ------------------------------------------------------ |
| 117 | */ |
| 118 | func print_alignment |
| 119 | /* The minimum ascii length is 3, e.g. for "x0" */ |
| 120 | adr x4, print_spacer - 3 |
| 121 | add x4, x4, x0 |
| 122 | b asm_print_str |
| 123 | endfunc print_alignment |
| 124 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 125 | /* |
| 126 | * Helper function to store x8 - x15 registers to |
| 127 | * the crash buf. The system registers values are |
| 128 | * copied to x8 to x15 by the caller which are then |
| 129 | * copied to the crash buf by this function. |
| 130 | * x0 points to the crash buf. It then calls |
| 131 | * size_controlled_print to print to console. |
| 132 | * Clobbers : x0 - x7, sp |
| 133 | */ |
| 134 | func str_in_crash_buf_print |
| 135 | /* restore the crash buf address in x0 */ |
| 136 | mrs x0, tpidr_el3 |
| 137 | stp x8, x9, [x0] |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 138 | stp x10, x11, [x0, #REGSZ * 2] |
| 139 | stp x12, x13, [x0, #REGSZ * 4] |
| 140 | stp x14, x15, [x0, #REGSZ * 6] |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 141 | b size_controlled_print |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 142 | endfunc str_in_crash_buf_print |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 143 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 144 | /* ------------------------------------------------------ |
| 145 | * This macro calculates the offset to crash buf from |
| 146 | * cpu_data and stores it in tpidr_el3. It also saves x0 |
| 147 | * and x1 in the crash buf by using sp as a temporary |
| 148 | * register. |
| 149 | * ------------------------------------------------------ |
| 150 | */ |
| 151 | .macro prepare_crash_buf_save_x0_x1 |
| 152 | /* we can corrupt this reg to free up x0 */ |
| 153 | mov sp, x0 |
| 154 | /* tpidr_el3 contains the address to cpu_data structure */ |
| 155 | mrs x0, tpidr_el3 |
| 156 | /* Calculate the Crash buffer offset in cpu_data */ |
| 157 | add x0, x0, #CPU_DATA_CRASH_BUF_OFFSET |
| 158 | /* Store crash buffer address in tpidr_el3 */ |
| 159 | msr tpidr_el3, x0 |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 160 | str x1, [x0, #REGSZ] |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 161 | mov x1, sp |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 162 | str x1, [x0] |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 163 | .endm |
| 164 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 165 | /* ----------------------------------------------------- |
| 166 | * This function allows to report a crash (if crash |
| 167 | * reporting is enabled) when an unhandled exception |
| 168 | * occurs. It prints the CPU state via the crash console |
| 169 | * making use of the crash buf. This function will |
| 170 | * not return. |
| 171 | * ----------------------------------------------------- |
| 172 | */ |
| 173 | func report_unhandled_exception |
| 174 | prepare_crash_buf_save_x0_x1 |
| 175 | adr x0, excpt_msg |
| 176 | mov sp, x0 |
| 177 | /* This call will not return */ |
| 178 | b do_crash_reporting |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 179 | endfunc report_unhandled_exception |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 180 | |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 181 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 182 | /* ----------------------------------------------------- |
| 183 | * This function allows to report a crash (if crash |
| 184 | * reporting is enabled) when an unhandled interrupt |
| 185 | * occurs. It prints the CPU state via the crash console |
| 186 | * making use of the crash buf. This function will |
| 187 | * not return. |
| 188 | * ----------------------------------------------------- |
| 189 | */ |
| 190 | func report_unhandled_interrupt |
| 191 | prepare_crash_buf_save_x0_x1 |
| 192 | adr x0, intr_excpt_msg |
| 193 | mov sp, x0 |
| 194 | /* This call will not return */ |
| 195 | b do_crash_reporting |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 196 | endfunc report_unhandled_interrupt |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 197 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 198 | /* ----------------------------------------------------- |
| 199 | * This function allows to report a crash (if crash |
| 200 | * reporting is enabled) when panic() is invoked from |
| 201 | * C Runtime. It prints the CPU state via the crash |
| 202 | * console making use of the crash buf. This function |
| 203 | * will not return. |
| 204 | * ----------------------------------------------------- |
| 205 | */ |
| 206 | func el3_panic |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 207 | msr spsel, #MODE_SP_ELX |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 208 | prepare_crash_buf_save_x0_x1 |
| 209 | adr x0, panic_msg |
| 210 | mov sp, x0 |
| 211 | /* This call will not return */ |
| 212 | b do_crash_reporting |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 213 | endfunc el3_panic |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 214 | |
| 215 | /* ------------------------------------------------------------ |
| 216 | * The common crash reporting functionality. It requires x0 |
| 217 | * and x1 has already been stored in crash buf, sp points to |
| 218 | * crash message and tpidr_el3 contains the crash buf address. |
| 219 | * The function does the following: |
| 220 | * - Retrieve the crash buffer from tpidr_el3 |
| 221 | * - Store x2 to x6 in the crash buffer |
| 222 | * - Initialise the crash console. |
| 223 | * - Print the crash message by using the address in sp. |
| 224 | * - Print x30 value to the crash console. |
| 225 | * - Print x0 - x7 from the crash buf to the crash console. |
| 226 | * - Print x8 - x29 (in groups of 8 registers) using the |
| 227 | * crash buf to the crash console. |
| 228 | * - Print el3 sys regs (in groups of 8 registers) using the |
| 229 | * crash buf to the crash console. |
| 230 | * - Print non el3 sys regs (in groups of 8 registers) using |
| 231 | * the crash buf to the crash console. |
| 232 | * ------------------------------------------------------------ |
| 233 | */ |
| 234 | func do_crash_reporting |
| 235 | /* Retrieve the crash buf from tpidr_el3 */ |
| 236 | mrs x0, tpidr_el3 |
| 237 | /* Store x2 - x6, x30 in the crash buffer */ |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 238 | stp x2, x3, [x0, #REGSZ * 2] |
| 239 | stp x4, x5, [x0, #REGSZ * 4] |
| 240 | stp x6, x30, [x0, #REGSZ * 6] |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 241 | /* Initialize the crash console */ |
| 242 | bl plat_crash_console_init |
| 243 | /* Verify the console is initialized */ |
| 244 | cbz x0, crash_panic |
| 245 | /* Print the crash message. sp points to the crash message */ |
| 246 | mov x4, sp |
| 247 | bl asm_print_str |
Alexei Fedorov | c4dfb3b | 2019-07-29 13:34:07 +0100 | [diff] [blame] | 248 | /* Print spaces to align "x30" string */ |
| 249 | mov x0, #4 |
| 250 | bl print_alignment |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 251 | /* load the crash buf address */ |
| 252 | mrs x0, tpidr_el3 |
| 253 | /* report x30 first from the crash buf */ |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 254 | ldr x4, [x0, #REGSZ * 7] |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 255 | bl asm_print_hex |
| 256 | bl print_newline |
| 257 | /* Load the crash buf address */ |
| 258 | mrs x0, tpidr_el3 |
| 259 | /* Now mov x7 into crash buf */ |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 260 | str x7, [x0, #REGSZ * 7] |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 261 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 262 | /* Report x0 - x29 values stored in crash buf*/ |
| 263 | /* Store the ascii list pointer in x6 */ |
| 264 | adr x6, gp_regs |
| 265 | /* Print x0 to x7 from the crash buf */ |
| 266 | bl size_controlled_print |
| 267 | /* Store x8 - x15 in crash buf and print */ |
| 268 | bl str_in_crash_buf_print |
| 269 | /* Load the crash buf address */ |
| 270 | mrs x0, tpidr_el3 |
| 271 | /* Store the rest of gp regs and print */ |
| 272 | stp x16, x17, [x0] |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 273 | stp x18, x19, [x0, #REGSZ * 2] |
| 274 | stp x20, x21, [x0, #REGSZ * 4] |
| 275 | stp x22, x23, [x0, #REGSZ * 6] |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 276 | bl size_controlled_print |
| 277 | /* Load the crash buf address */ |
| 278 | mrs x0, tpidr_el3 |
| 279 | stp x24, x25, [x0] |
Julius Werner | 02eb727 | 2017-12-12 14:23:26 -0800 | [diff] [blame] | 280 | stp x26, x27, [x0, #REGSZ * 2] |
| 281 | stp x28, x29, [x0, #REGSZ * 4] |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 282 | bl size_controlled_print |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 283 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 284 | /* Print the el3 sys registers */ |
| 285 | adr x6, el3_sys_regs |
| 286 | mrs x8, scr_el3 |
| 287 | mrs x9, sctlr_el3 |
| 288 | mrs x10, cptr_el3 |
| 289 | mrs x11, tcr_el3 |
| 290 | mrs x12, daif |
| 291 | mrs x13, mair_el3 |
| 292 | mrs x14, spsr_el3 |
| 293 | mrs x15, elr_el3 |
| 294 | bl str_in_crash_buf_print |
| 295 | mrs x8, ttbr0_el3 |
| 296 | mrs x9, esr_el3 |
| 297 | mrs x10, far_el3 |
| 298 | bl str_in_crash_buf_print |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 299 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 300 | /* Print the non el3 sys registers */ |
| 301 | adr x6, non_el3_sys_regs |
| 302 | mrs x8, spsr_el1 |
| 303 | mrs x9, elr_el1 |
| 304 | mrs x10, spsr_abt |
| 305 | mrs x11, spsr_und |
| 306 | mrs x12, spsr_irq |
| 307 | mrs x13, spsr_fiq |
| 308 | mrs x14, sctlr_el1 |
| 309 | mrs x15, actlr_el1 |
| 310 | bl str_in_crash_buf_print |
| 311 | mrs x8, cpacr_el1 |
| 312 | mrs x9, csselr_el1 |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 313 | mrs x10, sp_el1 |
| 314 | mrs x11, esr_el1 |
| 315 | mrs x12, ttbr0_el1 |
| 316 | mrs x13, ttbr1_el1 |
| 317 | mrs x14, mair_el1 |
| 318 | mrs x15, amair_el1 |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 319 | bl str_in_crash_buf_print |
| 320 | mrs x8, tcr_el1 |
| 321 | mrs x9, tpidr_el1 |
| 322 | mrs x10, tpidr_el0 |
| 323 | mrs x11, tpidrro_el0 |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 324 | mrs x12, par_el1 |
| 325 | mrs x13, mpidr_el1 |
| 326 | mrs x14, afsr0_el1 |
| 327 | mrs x15, afsr1_el1 |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 328 | bl str_in_crash_buf_print |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 329 | mrs x8, contextidr_el1 |
| 330 | mrs x9, vbar_el1 |
| 331 | mrs x10, cntp_ctl_el0 |
| 332 | mrs x11, cntp_cval_el0 |
| 333 | mrs x12, cntv_ctl_el0 |
| 334 | mrs x13, cntv_cval_el0 |
| 335 | mrs x14, cntkctl_el1 |
| 336 | mrs x15, sp_el0 |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 337 | bl str_in_crash_buf_print |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 338 | mrs x8, isr_el1 |
| 339 | bl str_in_crash_buf_print |
| 340 | |
| 341 | #if CTX_INCLUDE_AARCH32_REGS |
| 342 | /* Print the AArch32 registers */ |
| 343 | adr x6, aarch32_regs |
| 344 | mrs x8, dacr32_el2 |
| 345 | mrs x9, ifsr32_el2 |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 346 | bl str_in_crash_buf_print |
Imre Kis | b5b903c | 2019-07-22 11:56:45 +0200 | [diff] [blame] | 347 | #endif /* CTX_INCLUDE_AARCH32_REGS */ |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 348 | |
Soby Mathew | 38b4bc9 | 2014-08-14 13:36:41 +0100 | [diff] [blame] | 349 | /* Get the cpu specific registers to report */ |
| 350 | bl do_cpu_reg_dump |
| 351 | bl str_in_crash_buf_print |
Soby Mathew | 0da9593 | 2014-07-16 09:23:52 +0100 | [diff] [blame] | 352 | |
Gerald Lejeune | 2c7ed5b | 2015-11-26 15:47:53 +0100 | [diff] [blame] | 353 | /* Print some platform registers */ |
| 354 | plat_crash_print_regs |
Soby Mathew | 0da9593 | 2014-07-16 09:23:52 +0100 | [diff] [blame] | 355 | |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 356 | bl plat_crash_console_flush |
| 357 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 358 | /* Done reporting */ |
Jeenu Viswambharan | 68aef10 | 2016-11-30 15:21:11 +0000 | [diff] [blame] | 359 | no_ret plat_panic_handler |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 360 | endfunc do_crash_reporting |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 361 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 362 | #else /* CRASH_REPORTING */ |
| 363 | func report_unhandled_exception |
| 364 | report_unhandled_interrupt: |
Jeenu Viswambharan | 68aef10 | 2016-11-30 15:21:11 +0000 | [diff] [blame] | 365 | no_ret plat_panic_handler |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 366 | endfunc report_unhandled_exception |
Sandrine Bailleux | f4119ec | 2015-12-17 13:58:58 +0000 | [diff] [blame] | 367 | #endif /* CRASH_REPORTING */ |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 368 | |
Soby Mathew | 5e5c207 | 2014-04-07 15:28:55 +0100 | [diff] [blame] | 369 | |
Soby Mathew | c1adbbc | 2014-06-25 10:07:40 +0100 | [diff] [blame] | 370 | func crash_panic |
Jeenu Viswambharan | 68aef10 | 2016-11-30 15:21:11 +0000 | [diff] [blame] | 371 | no_ret plat_panic_handler |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 372 | endfunc crash_panic |