aboutsummaryrefslogtreecommitdiff
path: root/libk/stdlib/abort.cc
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-02-22 09:59:58 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-02-22 09:59:58 +0200
commitfb9d73ff32de7c83552707622512be0ef1db241c (patch)
tree2187542a85c998c43952ecf39c8f9598ba8f6929 /libk/stdlib/abort.cc
parentKconfig (diff)
downloadkernel.cpp-fb9d73ff32de7c83552707622512be0ef1db241c.tar.xz
Enable interrupts
Diffstat (limited to 'libk/stdlib/abort.cc')
-rw-r--r--libk/stdlib/abort.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/libk/stdlib/abort.cc b/libk/stdlib/abort.cc
new file mode 100644
index 0000000..56ca7ee
--- /dev/null
+++ b/libk/stdlib/abort.cc
@@ -0,0 +1,15 @@
+#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();
+}