]>
Commit | Line | Data |
---|---|---|
8a0743cf AL |
1 | /* |
2 | * libqos malloc support | |
3 | * | |
4 | * Copyright IBM, Corp. 2012-2013 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <aliguori@us.ibm.com> | |
8 | * | |
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. | |
11 | */ | |
12 | ||
13 | #ifndef LIBQOS_MALLOC_H | |
14 | #define LIBQOS_MALLOC_H | |
15 | ||
16 | #include <stdint.h> | |
17 | #include <sys/types.h> | |
292be092 | 18 | #include "qemu/queue.h" |
8a0743cf | 19 | |
292be092 MM |
20 | typedef enum { |
21 | ALLOC_NO_FLAGS = 0x00, | |
22 | ALLOC_LEAK_WARN = 0x01, | |
23 | ALLOC_LEAK_ASSERT = 0x02, | |
24 | ALLOC_PARANOID = 0x04 | |
25 | } QAllocOpts; | |
26 | ||
f6f363c1 | 27 | typedef struct QGuestAllocator QGuestAllocator; |
292be092 | 28 | |
292be092 | 29 | void alloc_uninit(QGuestAllocator *allocator); |
8a0743cf AL |
30 | |
31 | /* Always returns page aligned values */ | |
292be092 MM |
32 | uint64_t guest_alloc(QGuestAllocator *allocator, size_t size); |
33 | void guest_free(QGuestAllocator *allocator, uint64_t addr); | |
8a0743cf | 34 | |
af77f2cd | 35 | QGuestAllocator *alloc_init(uint64_t start, uint64_t end); |
fa02e608 JS |
36 | QGuestAllocator *alloc_init_flags(QAllocOpts flags, |
37 | uint64_t start, uint64_t end); | |
f6f363c1 | 38 | void alloc_set_page_size(QGuestAllocator *allocator, size_t page_size); |
259342d3 | 39 | void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts); |
f6f363c1 | 40 | |
8a0743cf | 41 | #endif |