aboutsummaryrefslogtreecommitdiff
path: root/libk/stdlib/abort.cc
blob: 13bee4d9de30217df317cb9e8fab46262bde07d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "stdlib.h"

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
   */

  asm volatile("cli");
  while (true) asm volatile("hlt");
  __builtin_unreachable();
}