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) \
23 Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT)); \
24 Print("Failed assertion in %s: %s at %s, line %d, RA=%lx, thread=%p\n",\
25 __func__, #cond, __FILE__, __LINE__, \
26 (ulong_t) __builtin_return_address(0), \
33 #define TODO(message) \
35 Set_Current_Attr(ATTRIB(BLUE, GRAY|BRIGHT)); \
36 Print("Unimplemented feature: %s\n", (message)); \
42 * Spin for some number of iterations.
43 * This is useful for slowing down things that go by too
46 #define PAUSE(count) \
49 for (i = 0; i < (count); ++i) \
56 * The debug macros are no-ops when NDEBUG is defined.
66 * Its behavior does not depend on whether or not this
69 #define STOP() while (1)
74 #define Panic(args...) \
76 Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT)); \
81 #endif /* GEEKOS_KASSERT_H */