} \
} 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; \
-#define V3_CREATE_THREAD(fn, arg, name) ({ \
+#define V3_CREATE_AND_START_THREAD(fn, arg, name) ({ \
void * thread = NULL; \
extern struct v3_os_hooks * os_hooks; \
if ((os_hooks) && (os_hooks)->start_kernel_thread) { \
} \
})
+#define V3_CREATE_AND_START_THREAD_ON_CPU(cpu, fn, arg, name) ({ \
+ void *thread = V3_CREATE_THREAD_ON_CPU(cpu,fn,arg,name); \
+ if (thread) { \
+ V3_START_THREAD(thread); \
+ } \
+ thread; \
+ })
+
#define V3_MOVE_THREAD_TO_CPU(pcpu, thread) ({ \
int ret = -1; \
extern struct v3_os_hooks * 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);
void Shutdown_V3( void );
-struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name);
+struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name, unsigned int cpu_mask);
int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask);
int v3_stop_vm(struct v3_vm_info * vm);
int v3_pause_vm(struct v3_vm_info * vm);