Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Avoid strict-aliasing related issues when compiling with optimization
[palacios.git] / linux_module / memcheck.h
1 #ifndef _memcheck
2 #define _memcheck
3
4 typedef enum {
5   PALACIOS_KMALLOC, 
6   PALACIOS_VMALLOC,
7   PALACIOS_PAGE_ALLOC
8 } palacios_memcheck_memtype_t;
9
10 #ifdef V3_CONFIG_DEBUG_MEM_ALLOC
11
12 // Maxmimum number of simultaneous allocations to handle
13 #define NUM_ALLOCS        16384
14
15 //
16 // The following macros are used
17 // in the stub functions to call back to the memory
18 // checker - if memory allocation hecking is not enabled, these 
19 // turn into nothing
20 //
21 #define MEMCHECK_INIT() palacios_memcheck_init()
22 #define MEMCHECK_KMALLOC(ptr,size) palacios_memcheck_alloc(ptr,size,PALACIOS_KMALLOC)
23 #define MEMCHECK_KFREE(ptr)  palacios_memcheck_free(ptr,0,PALACIOS_KMALLOC)
24 #define MEMCHECK_VMALLOC(ptr,size) palacios_memcheck_alloc(ptr,size,PALACIOS_VMALLOC)
25 #define MEMCHECK_VFREE(ptr)  palacios_memcheck_free(ptr,0,PALACIOS_VMALLOC)
26 #define MEMCHECK_ALLOC_PAGES(ptr,size) palacios_memcheck_alloc(ptr,size,PALACIOS_PAGE_ALLOC)
27 #define MEMCHECK_FREE_PAGES(ptr,size)  palacios_memcheck_free(ptr,size,PALACIOS_PAGE_ALLOC)
28 #define MEMCHECK_DEINIT() palacios_memcheck_deinit()
29
30 void palacios_memcheck_init(void);
31 void palacios_memcheck_alloc(void *ptr, unsigned long size, palacios_memcheck_memtype_t type);
32 void palacios_memcheck_free(void *ptr, unsigned long size, palacios_memcheck_memtype_t type);
33 void palacios_memcheck_deinit(void);
34
35 #else
36
37 //
38 // The following is what happens when lock checking is not on
39 //
40 #define MEMCHECK_INIT()
41 #define MEMCHECK_KMALLOC(ptr,size) 
42 #define MEMCHECK_KFREE(ptr)  
43 #define MEMCHECK_VMALLOC(ptr,size) 
44 #define MEMCHECK_VFREE(ptr)  
45 #define MEMCHECK_ALLOC_PAGES(ptr,size) 
46 #define MEMCHECK_FREE_PAGES(ptr,size)  
47 #define MEMCHECK_DEINIT()
48
49 #endif
50
51
52 #endif