1 /*
2  * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #include <config.h>
8 #include <mode/machine.h>
9 #include <api/debug.h>
10 
idle_thread(void)11 void idle_thread(void)
12 {
13     while (1) {
14         wfi();
15     }
16 }
17 
18 /** DONT_TRANSLATE */
halt(void)19 void NORETURN NO_INLINE VISIBLE halt(void)
20 {
21     /* halt is actually, idle thread without the interrupts */
22     MSR("daif", (DAIF_DEBUG | DAIF_SERROR | DAIF_IRQ | DAIF_FIRQ));
23 
24 #ifdef CONFIG_PRINTING
25     printf("halting...");
26 #ifdef CONFIG_DEBUG_BUILD
27     debug_printKernelEntryReason();
28 #endif
29 #endif
30     idle_thread();
31     UNREACHABLE();
32 }
33