Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Hafnium Authors. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "hf/abort.h" |
| 18 | |
Andrew Scull | f825293 | 2019-04-04 13:51:22 +0100 | [diff] [blame^] | 19 | #include "hf/dlog.h" |
| 20 | |
Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 21 | /** |
| 22 | * Causes execution to halt and prevent progress of the current and less |
| 23 | * privileged software components. This should be triggered when a |
| 24 | * non-recoverable event is identified which leaves the system in an |
| 25 | * inconsistent state. |
| 26 | * |
| 27 | * TODO: Should this also reset the system? |
| 28 | */ |
| 29 | noreturn void abort(void) |
| 30 | { |
| 31 | /* TODO: Block all CPUs. */ |
| 32 | for (;;) { |
Andrew Scull | f825293 | 2019-04-04 13:51:22 +0100 | [diff] [blame^] | 33 | /* Prevent loop being optimized away. */ |
| 34 | __asm__ volatile("nop"); |
Andrew Scull | a59f9bc | 2019-04-03 15:24:35 +0100 | [diff] [blame] | 35 | } |
| 36 | } |