X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm.h;h=14bbb2b48d791355f6e8de67f1cb745ae9cf0d5c;hp=1f6228e753e69747123ebaa8940d70665d04df71;hb=659151a0b655c619f3acbb98a45e9eeb8002a4b3;hpb=a2c42ecf5c65f014a1a22b6a3fc3548482c4ec22 diff --git a/palacios/include/palacios/vmm.h b/palacios/include/palacios/vmm.h index 1f6228e..14bbb2b 100644 --- a/palacios/include/palacios/vmm.h +++ b/palacios/include/palacios/vmm.h @@ -147,6 +147,24 @@ int v3_get_vcore(struct guest_info *); } \ } while (0) +#define V3_VMalloc(size) ({ \ + extern struct v3_os_hooks * os_hooks; \ + void * var = 0; \ + if ((os_hooks) && (os_hooks)->vmalloc) { \ + var = (os_hooks)->vmalloc(size); \ + } \ + if (!var) PrintError(VM_NONE,VCORE_NONE,"VMALLOC FAILURE. Memory LEAK!!\n"); \ + var; \ + }) + +#define V3_VFree(addr) \ + do { \ + extern struct v3_os_hooks * os_hooks; \ + if ((os_hooks) && (os_hooks)->vfree) { \ + (os_hooks)->vfree(addr); \ + } \ + } while (0) + // uint_t V3_CPU_KHZ(); #define V3_CPU_KHZ() ({ \ unsigned int khz = 0; \ @@ -338,10 +356,16 @@ struct v3_os_hooks { // For page allocation: // - node_id -1 => any node, otherwise the numa node we want to alloc from // - constraint = 0 => no constraints, otherwise a bitwise-or of the following flags + // Allocates physically contiguous pages #define V3_ALLOC_PAGES_CONSTRAINT_4GB 1 void *(*allocate_pages)(int num_pages, unsigned int alignment, int node_id, int constraint); void (*free_pages)(void * page, int num_pages); + // Allocates virtually contiguous memory + void *(*vmalloc)(unsigned int size); + void (*vfree)(void * addr); + + // Allocates virtually and physically contiguous memory void *(*malloc)(unsigned int size); void (*free)(void * addr);