Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Hafnium Authors. |
| 3 | * |
Andrew Walbran | e959ec1 | 2020-06-17 15:01:09 +0100 | [diff] [blame^] | 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include "hf/abort.h" |
| 10 | |
| 11 | /** |
| 12 | * Causes execution to halt and prevent progress of the current and less |
| 13 | * privileged software components. This should be triggered when a |
| 14 | * non-recoverable event is identified which leaves the system in an |
| 15 | * inconsistent state. |
| 16 | * |
| 17 | * TODO: Should this also reset the system? |
| 18 | */ |
| 19 | noreturn void abort(void) |
| 20 | { |
| 21 | /* TODO: Block all CPUs. */ |
| 22 | for (;;) { |
Andrew Scull | f825293 | 2019-04-04 13:51:22 +0100 | [diff] [blame] | 23 | /* Prevent loop being optimized away. */ |
| 24 | __asm__ volatile("nop"); |
Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 25 | } |
| 26 | } |