[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 6/9] kernel2: BUG_ON-Makro eingeführt
+ kernel2: BUG_ON prüft eine Bedingung und führt zu einem Panic, wenn
die Bedingung wahr ist
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/kernel2/include/kernel.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/kernel2/include/kernel.h b/src/kernel2/include/kernel.h
index ae82d88..7fa8209 100644
--- a/src/kernel2/include/kernel.h
+++ b/src/kernel2/include/kernel.h
@@ -42,4 +42,14 @@ extern uint64_t timer_ticks;
__attribute__((noreturn)) void panic(char* message, ...);
+#define BUG_ON(c) \
+ do { \
+ if (c) { \
+ panic("BUG: %s:%d: " #c, __FILE__, __LINE__); \
+ } \
+ } while(0)
+
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
#endif
--
1.6.0.2