]> git.proxmox.com Git - mirror_qemu.git/blob - tests/libqos/malloc.h
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[mirror_qemu.git] / tests / libqos / malloc.h
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 "qemu/queue.h"
17
18 typedef enum {
19 ALLOC_NO_FLAGS = 0x00,
20 ALLOC_LEAK_WARN = 0x01,
21 ALLOC_LEAK_ASSERT = 0x02,
22 ALLOC_PARANOID = 0x04
23 } QAllocOpts;
24
25 typedef struct QGuestAllocator QGuestAllocator;
26
27 void alloc_uninit(QGuestAllocator *allocator);
28
29 /* Always returns page aligned values */
30 uint64_t guest_alloc(QGuestAllocator *allocator, size_t size);
31 void guest_free(QGuestAllocator *allocator, uint64_t addr);
32 void migrate_allocator(QGuestAllocator *src, QGuestAllocator *dst);
33
34 QGuestAllocator *alloc_init(uint64_t start, uint64_t end);
35 QGuestAllocator *alloc_init_flags(QAllocOpts flags,
36 uint64_t start, uint64_t end);
37 void alloc_set_page_size(QGuestAllocator *allocator, size_t page_size);
38 void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts);
39
40 #endif