1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13#include <config.h>
14#include <api/debug.h>
15
16void idle_thread(void)
17{
18    while (1) {
19        asm volatile("hlt");
20    }
21}
22
23/** DONT_TRANSLATE */
24void VISIBLE halt(void)
25{
26    /* halt is actually, idle thread without the interrupts */
27    asm volatile("cli");
28
29#ifdef CONFIG_PRINTING
30    printf("halting...");
31#ifdef CONFIG_DEBUG_BUILD
32    debug_printKernelEntryReason();
33#endif
34#endif
35    idle_thread();
36    UNREACHABLE();
37}
38