1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LIBQOS_MALLOC_H
14#define LIBQOS_MALLOC_H
15
16#include "qemu/queue.h"
17#include "libqtest.h"
18
19typedef enum {
20 ALLOC_NO_FLAGS = 0x00,
21 ALLOC_LEAK_WARN = 0x01,
22 ALLOC_LEAK_ASSERT = 0x02,
23 ALLOC_PARANOID = 0x04
24} QAllocOpts;
25
26typedef struct QGuestAllocator QGuestAllocator;
27
28void alloc_uninit(QGuestAllocator *allocator);
29
30
31uint64_t guest_alloc(QGuestAllocator *allocator, size_t size);
32void guest_free(QGuestAllocator *allocator, uint64_t addr);
33void migrate_allocator(QGuestAllocator *src, QGuestAllocator *dst);
34
35QGuestAllocator *alloc_init(uint64_t start, uint64_t end);
36QGuestAllocator *alloc_init_flags(QAllocOpts flags,
37 uint64_t start, uint64_t end);
38void alloc_set_page_size(QGuestAllocator *allocator, size_t page_size);
39void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts);
40
41#endif
42