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 SANITYCHECK(l) if((l) <= vm_sanitychecklevel) { \
18 u32_t *origptr = CHECKADDR;\
22 for(_sanep = 0; _sanep < sizeof(data1) / sizeof(*origptr); \
24 if(origptr[_sanep] != data1[_sanep]) { \
25 printf("%d: %08lx != %08lx ", \
26 _sanep, origptr[_sanep], data1[_sanep]); failflag = 1; \
30 printf("%s:%d: memory corruption test failed\n", \
31 __FILE__, __LINE__); \
32 vm_panic("memory corruption", NO_NUM); \
34 for(vmp = vmproc; vmp <= &vmproc[_NR_PROCS]; vmp++) { \
35 if((vmp->vm_flags & (VMF_INUSE | VMF_HASPT)) == \
36 (VMF_INUSE | VMF_HASPT)) { \
37 pt_sanitycheck(&vmp->vm_pt, __FILE__, __LINE__); \
40 map_sanitycheck(__FILE__, __LINE__); \