2 * libqos malloc support
4 * Copyright IBM, Corp. 2012-2013
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #ifndef LIBQOS_MALLOC_H
14 #define LIBQOS_MALLOC_H
17 #include <sys/types.h>
18 #include "qemu/queue.h"
21 ALLOC_NO_FLAGS
= 0x00,
22 ALLOC_LEAK_WARN
= 0x01,
23 ALLOC_LEAK_ASSERT
= 0x02,
27 typedef struct QGuestAllocator QGuestAllocator
;
29 void alloc_uninit(QGuestAllocator
*allocator
);
31 /* Always returns page aligned values */
32 uint64_t guest_alloc(QGuestAllocator
*allocator
, size_t size
);
33 void guest_free(QGuestAllocator
*allocator
, uint64_t addr
);
34 void migrate_allocator(QGuestAllocator
*src
, QGuestAllocator
*dst
);
36 QGuestAllocator
*alloc_init(uint64_t start
, uint64_t end
);
37 QGuestAllocator
*alloc_init_flags(QAllocOpts flags
,
38 uint64_t start
, uint64_t end
);
39 void alloc_set_page_size(QGuestAllocator
*allocator
, size_t page_size
);
40 void alloc_set_flags(QGuestAllocator
*allocator
, QAllocOpts opts
);