98
98
#error "Don't define FILECODE. It is obsolete."
102
* Internal macros, functions, and strings
104
* The monitor wants to save space at call sites, so it has specialized
105
* functions for each situation. User level wants to save on implementation
106
* so it uses generic functions.
109
#if !defined VMM || defined MONITOR_APP // {
112
// vmkernel Panic() function does not want a trailing newline.
113
#define _ASSERT_PANIC(name) \
114
Panic(_##name##Fmt, __FILE__, __LINE__)
115
#define _ASSERT_PANIC_BUG(bug, name) \
116
Panic(_##name##Fmt " bugNr=%d", __FILE__, __LINE__, bug)
117
#define _ASSERT_PANIC_NORETURN(name) \
118
Panic_NoReturn(_##name##Fmt, __FILE__, __LINE__)
120
#else /* !VMKERNEL */
121
#define _ASSERT_PANIC(name) \
122
Panic(_##name##Fmt "\n", __FILE__, __LINE__)
123
#define _ASSERT_PANIC_BUG(bug, name) \
124
Panic(_##name##Fmt " bugNr=%d\n", __FILE__, __LINE__, bug)
125
#endif /* VMKERNEL */
127
#define AssertLengthFmt _AssertLengthFmt
128
#define AssertUnexpectedFmt _AssertUnexpectedFmt
129
#define AssertNotTestedFmt _AssertNotTestedFmt
134
// these don't have newline so a bug can be tacked on
135
#define _AssertPanicFmt "PANIC %s:%d"
136
#define _AssertAssertFmt "ASSERT %s:%d"
137
#define _AssertNotImplementedFmt "NOT_IMPLEMENTED %s:%d"
138
#define _AssertNotReachedFmt "NOT_REACHED %s:%d"
139
#define _AssertMemAllocFmt "MEM_ALLOC %s:%d"
141
// these are complete formats with newline
142
#define _AssertLengthFmt "LENGTH %s:%d r=%#x e=%#x\n"
143
#define _AssertUnexpectedFmt "UNEXPECTED %s:%d bugNr=%d\n"
144
#define _AssertNotTestedFmt "NOT_TESTED %s:%d\n"
103
149
* Panic and log functions
106
152
EXTERN void Log(const char *fmt, ...) PRINTF_DECL(1, 2);
107
153
EXTERN void Warning(const char *fmt, ...) PRINTF_DECL(1, 2);
155
EXTERN NORETURN void Panic_NoReturn(const char *fmt, ...) PRINTF_DECL(1, 2);
157
#if defined VMKERNEL && defined VMX86_DEBUG
158
EXTERN void Panic(const char *fmt, ...) PRINTF_DECL(1, 2);
108
160
EXTERN NORETURN void Panic(const char *fmt, ...) PRINTF_DECL(1, 2);
110
163
EXTERN void LogThrottled(uint32 *count, const char *fmt, ...)
111
164
PRINTF_DECL(2, 3);
173
226
#define ASSERT_NOT_IMPLEMENTED_BUG(bug, cond) \
174
227
ASSERT_IFNOT(cond, NOT_IMPLEMENTED_BUG(bug))
229
#if defined VMKERNEL && defined VMX86_DEBUG
230
#define NOT_IMPLEMENTED() _ASSERT_PANIC_NORETURN(AssertNotImplemented)
176
232
#define NOT_IMPLEMENTED() _ASSERT_PANIC(AssertNotImplemented)
177
234
#define NOT_IMPLEMENTED_BUG(bug) _ASSERT_PANIC_BUG(bug, AssertNotImplemented)
236
#if defined VMKERNEL && defined VMX86_DEBUG
237
#define NOT_REACHED() _ASSERT_PANIC_NORETURN(AssertNotReached)
179
239
#define NOT_REACHED() _ASSERT_PANIC(AssertNotReached)
180
241
#define NOT_REACHED_BUG(bug) _ASSERT_PANIC_BUG(bug, AssertNotReached)
182
243
#define ASSERT_MEM_ALLOC(cond) \
343
* Internal macros, functions, and strings
345
* The monitor wants to save space at call sites, so it has specialized
346
* functions for each situation. User level wants to save on implementation
347
* so it uses generic functions.
350
#if !defined VMM || defined MONITOR_APP // {
353
// vmkernel Panic() function does not want a trailing newline.
354
#define _ASSERT_PANIC(name) \
355
Panic(_##name##Fmt, __FILE__, __LINE__)
356
#define _ASSERT_PANIC_BUG(bug, name) \
357
Panic(_##name##Fmt " bugNr=%d", __FILE__, __LINE__, bug)
359
#else /* !VMKERNEL */
360
#define _ASSERT_PANIC(name) \
361
Panic(_##name##Fmt "\n", __FILE__, __LINE__)
362
#define _ASSERT_PANIC_BUG(bug, name) \
363
Panic(_##name##Fmt " bugNr=%d\n", __FILE__, __LINE__, bug)
364
#endif /* VMKERNEL */
366
#define AssertLengthFmt _AssertLengthFmt
367
#define AssertUnexpectedFmt _AssertUnexpectedFmt
368
#define AssertNotTestedFmt _AssertNotTestedFmt
372
// these don't have newline so a bug can be tacked on
373
#define _AssertPanicFmt "PANIC %s:%d"
374
#define _AssertAssertFmt "ASSERT %s:%d"
375
#define _AssertNotImplementedFmt "NOT_IMPLEMENTED %s:%d"
376
#define _AssertNotReachedFmt "NOT_REACHED %s:%d"
377
#define _AssertMemAllocFmt "MEM_ALLOC %s:%d"
379
// these are complete formats with newline
380
#define _AssertLengthFmt "LENGTH %s:%d r=%#x e=%#x\n"
381
#define _AssertUnexpectedFmt "UNEXPECTED %s:%d bugNr=%d\n"
382
#define _AssertNotTestedFmt "NOT_TESTED %s:%d\n"
384
403
#endif /* ifndef _VM_ASSERT_H_ */