2 #define _SANITYCHECK_H 1
9 /* This macro is used in the sanity check functions, where file and
10 * line are function arguments.
12 #define MYASSERT(c) do { if(!(c)) { \
13 printf("VM:%s:%d: %s failed\n", file, line, #c); \
14 vm_panic("sanity check failed", NO_NUM); } } while(0)
16 #define SLABSANITYCHECK(l) if((l) <= vm_sanitychecklevel) { \
17 slab_sanitycheck(__FILE__, __LINE__); }
19 #define SANITYCHECK(l) if(!nocheck && ((l) <= vm_sanitychecklevel)) { \
21 vm_assert(incheck == 0); \
24 slab_sanitycheck(__FILE__, __LINE__); \
25 for(vmp = vmproc; vmp < &vmproc[VMP_NR]; vmp++) { \
26 if((vmp->vm_flags & (VMF_INUSE | VMF_HASPT)) == \
27 (VMF_INUSE | VMF_HASPT)) { \
28 PT_SANE(&vmp->vm_pt); \
31 map_sanitycheck(__FILE__, __LINE__); \
32 vm_assert(incheck == 1); \
36 #include "../../kernel/proc.h"
38 #define USE(obj, code) do { \
39 slabunlock(obj, sizeof(*obj)); \
43 slablock(obj, sizeof(*obj)); \
46 #define SLABSANE(ptr) { \
47 if(!slabsane_f(__FILE__, __LINE__, ptr, sizeof(*(ptr)))) { \
48 printf("VM:%s:%d: SLABSANE(%s)\n", __FILE__, __LINE__, #ptr); \
49 vm_panic("SLABSANE failed", NO_NUM); \
53 #define NOTRUNNABLE(ep) { \
55 if(sys_getproc(&pr, ep) != OK) { \
56 vm_panic("VM: sys_getproc failed", ep); \
58 if(!pr.p_rts_flags) { \
59 vm_panic("VM: runnable", ep); \
65 #define SLABSANITYCHECK(l)
66 #define USE(obj, code) do { code } while(0)
68 #define NOTRUNNABLE(ep)