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 <api/debug.h>
9
10void idle_thread(void)
11{
12    while (1) {
13        asm volatile("hlt");
14    }
15}
16
17/** DONT_TRANSLATE */
18void VISIBLE halt(void)
19{
20    /* halt is actually, idle thread without the interrupts */
21    asm volatile("cli");
22
23#ifdef CONFIG_PRINTING
24    printf("halting...");
25#ifdef CONFIG_DEBUG_BUILD
26    debug_printKernelEntryReason();
27#endif
28#endif
29    idle_thread();
30    UNREACHABLE();
31}
32