Ken Liu | 2e43489 | 2022-02-16 12:10:16 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | #include "cmsis.h" |
| 8 | #include "exception_info.h" |
| 9 | |
| 10 | __attribute__((naked)) void HardFault_Handler(void) |
| 11 | { |
| 12 | EXCEPTION_INFO(EXCEPTION_TYPE_HARDFAULT); |
| 13 | |
| 14 | /* A HardFault may indicate corruption of secure state, so it is essential |
| 15 | * that Non-secure code does not regain control after one is raised. |
| 16 | * Returning from this exception could allow a pending NS exception to be |
| 17 | * taken, so the current solution is not to return. |
| 18 | */ |
| 19 | __ASM volatile("b ."); |
| 20 | } |
| 21 | |
| 22 | __attribute__((naked)) void MemManage_Handler(void) |
| 23 | { |
| 24 | EXCEPTION_INFO(EXCEPTION_TYPE_MEMFAULT); |
| 25 | |
| 26 | /* A MemManage fault may indicate corruption of secure state, so it is |
| 27 | * essential that Non-secure code does not regain control after one is |
| 28 | * raised. Returning from this exception could allow a pending NS exception |
| 29 | * to be taken, so the current solution is not to return. |
| 30 | */ |
| 31 | __ASM volatile("b ."); |
| 32 | } |
| 33 | |
| 34 | __attribute__((naked)) void BusFault_Handler(void) |
| 35 | { |
| 36 | EXCEPTION_INFO(EXCEPTION_TYPE_BUSFAULT); |
| 37 | |
| 38 | /* A BusFault may indicate corruption of secure state, so it is essential |
| 39 | * that Non-secure code does not regain control after one is raised. |
| 40 | * Returning from this exception could allow a pending NS exception to be |
| 41 | * taken, so the current solution is not to return. |
| 42 | */ |
| 43 | __ASM volatile("b ."); |
| 44 | } |
| 45 | |
| 46 | __attribute__((naked)) void SecureFault_Handler(void) |
| 47 | { |
| 48 | EXCEPTION_INFO(EXCEPTION_TYPE_SECUREFAULT); |
| 49 | |
| 50 | /* A SecureFault may indicate corruption of secure state, so it is essential |
| 51 | * that Non-secure code does not regain control after one is raised. |
| 52 | * Returning from this exception could allow a pending NS exception to be |
| 53 | * taken, so the current solution is not to return. |
| 54 | */ |
| 55 | __ASM volatile("b ."); |
| 56 | } |
| 57 | |
| 58 | __attribute__((naked)) void UsageFault_Handler(void) |
| 59 | { |
| 60 | EXCEPTION_INFO(EXCEPTION_TYPE_USAGEFAULT); |
| 61 | __ASM volatile("b ."); |
| 62 | } |