phys addr arg of 0 must be possible for pt_writemap too (instead of meaning
[minix.git] / servers / vm / sanitycheck.h
blobcc53879c9c1cb435e0a2ed98db8ee5a8653497fb
1 #ifndef _SANITYCHECK_H
2 #define _SANITYCHECK_H 1
4 #include "vm.h"
5 #include "glo.h"
7 #if SANITYCHECKS
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) { \
17 int failflag = 0; \
18 u32_t *origptr = CHECKADDR;\
19 int _sanep; \
20 struct vmproc *vmp; \
22 for(_sanep = 0; _sanep < sizeof(data1) / sizeof(*origptr); \
23 _sanep++) { \
24 if(origptr[_sanep] != data1[_sanep]) { \
25 printf("%d: %08lx != %08lx ", \
26 _sanep, origptr[_sanep], data1[_sanep]); failflag = 1; \
27 } \
28 } \
29 if(failflag) { \
30 printf("%s:%d: memory corruption test failed\n", \
31 __FILE__, __LINE__); \
32 vm_panic("memory corruption", NO_NUM); \
33 } \
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__); \
38 } \
39 } \
40 map_sanitycheck(__FILE__, __LINE__); \
42 #else
43 #define SANITYCHECK
44 #endif
46 #endif