2 #define _SANITYCHECK_H 1
10 /* This macro is used in the sanity check functions, where file and
11 * line are function arguments.
13 #define MYASSERT(c) do { if(!(c)) { \
14 printf("VM:%s:%d: %s failed (last sanity check %s:%d)\n", file, line, #c, sc_lastfile, sc_lastline); \
15 panic("sanity check failed"); } } while(0)
17 #define SLABSANITYCHECK(l) if((l) <= vm_sanitychecklevel) { \
18 slab_sanitycheck(__FILE__, __LINE__); }
20 #define SANITYCHECK(l) if(!nocheck && ((l) <= vm_sanitychecklevel)) { \
21 struct vmproc *vmpr; \
22 assert(incheck == 0); \
25 slab_sanitycheck(__FILE__, __LINE__); \
26 for(vmpr = vmproc; vmpr < &vmproc[VMP_NR]; vmpr++) { \
27 if((vmpr->vm_flags & (VMF_INUSE))) { \
28 PT_SANE(&vmpr->vm_pt); \
31 map_sanitycheck(__FILE__, __LINE__); \
32 mem_sanitycheck(__FILE__, __LINE__); \
33 assert(incheck == 1); \
35 /* printf("(%s:%d OK) ", __FILE__, __LINE__); */ \
36 sc_lastfile = __FILE__; sc_lastline = __LINE__; \
39 #define SLABSANE(ptr) { \
40 if(!slabsane_f(__FILE__, __LINE__, ptr, sizeof(*(ptr)))) { \
41 printf("VM:%s:%d: SLABSANE(%s)\n", __FILE__, __LINE__, #ptr); \
42 panic("SLABSANE failed"); \
47 #define SANITYCHECK(l)
48 #define SLABSANITYCHECK(l)
53 #define USE(obj, code) do { \
54 slabunlock(obj, sizeof(*obj)); \
58 slablock(obj, sizeof(*obj)); \
61 #define USE(obj, code) do { code } while(0)