2 * Definition of KASSERT() macro, and other useful debug macros
3 * Copyright (c) 2001, David H. Hovemeyer <daveho@cs.umd.edu>
6 * This is free software. You are permitted to use,
7 * redistribute, and modify it as specified in the file "COPYING".
10 #ifndef GEEKOS_KASSERT_H
11 #define GEEKOS_KASSERT_H
13 #include <geekos/screen.h>
18 extern struct Kernel_Thread* g_currentThread;
20 #define KASSERT(cond) \
24 Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT)); \
25 Print("Failed assertion in %s: %s at %s, line %d, RA=%lx, thread=%p\n",\
26 __func__, #cond, __FILE__, __LINE__, \
27 (ulong_t) __builtin_return_address(0), \
34 #define TODO(message) \
37 Set_Current_Attr(ATTRIB(BLUE, GRAY|BRIGHT)); \
38 Print("Unimplemented feature: %s\n", (message)); \
44 * Spin for some number of iterations.
45 * This is useful for slowing down things that go by too
48 #define PAUSE(count) \
51 for (i = 0; i < (count); ++i) \
58 * The debug macros are no-ops when NDEBUG is defined.
68 * Its behavior does not depend on whether or not this
71 #define STOP() while (1) {Halt();}
76 #define Panic(args...) \
78 Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT)); \
83 #endif /* GEEKOS_KASSERT_H */