aboutsummaryrefslogtreecommitdiff
path: root/libk/stdlib/console.cc
blob: dee6a8f6b974c8bdb28bc317baf6c815ab2fd124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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();
}