Implement APIC, RTC, basic ACPI parser and timer support
[lunaix-os.git] / lunaix-os / includes / lunaix / spike.h
index fa4e797ddad4898649f9a290832c370ce8a774b1..9cf4b7fee0e442873e7a39498ca8252d1ff568f1 100644 (file)
 // 获取v最近的最小k倍数
 #define ROUNDDOWN(v, k)     ((v) & ~((k) - 1))
 
-static void inline spin() {
+inline static void spin() {
     while(1);
 }
 
+#ifdef __LUNAIXOS_DEBUG__
+#define assert(cond)                                  \
+    if (!(cond)) {                                    \
+        __assert_fail(#cond, __FILE__, __LINE__);     \
+    }
+
+#define assert_msg(cond, msg)                         \
+    if (!(cond)) {                                    \
+        __assert_fail(msg, __FILE__, __LINE__);   \
+    }
+void __assert_fail(const char* expr, const char* file, unsigned int line) __attribute__((noinline, noreturn));
+#else
+#define assert(cond) (void)(cond); //assert nothing
+#define assert_msg(cond, msg) (void)(cond);  //assert nothing
+#endif
+
+void panick(const char* msg);
+
+
+#define wait_until(cond)    while(!(cond));
+#define loop_until(cond)    while(!(cond));
+
+
 #endif /* __LUNAIX_SPIKE_H */