aboutsummaryrefslogtreecommitdiff
path: root/libk/stdlib/console.cc
blob: 308f0553e69c4f1581bccc5f13a44d38a67619c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "stdlib.h"

static Console* global_console = nullptr;

void Console::set(Console* ptr) {
  if (ptr != nullptr) {
    global_console = ptr;
  }
}

Console* Console::get() {
  return global_console;
}

void abort() {
  /*
   * On gcc, a 'while(true) {}' will infinitely loop
   * but clang will optimize it away on -O2 if it's empty
   * therefore, add no-op
   */
  while (true) {
    asm volatile("nop");
  }
  __builtin_unreachable();
}