hw/arm/sbsa-ref: Remove unnecessary check for secure_sysmem == NULL
[qemu/ar7.git] / tests / libqos / malloc.h
blob4d1a2e2bef4a0b94bcb8392ea51598ded98da37f
1 /*
2 * libqos malloc support
4 * Copyright IBM, Corp. 2012-2013
6 * Authors:
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
16 #include "qemu/queue.h"
17 #include "libqtest.h"
19 typedef enum {
20 ALLOC_NO_FLAGS = 0x00,
21 ALLOC_LEAK_WARN = 0x01,
22 ALLOC_LEAK_ASSERT = 0x02,
23 ALLOC_PARANOID = 0x04
24 } QAllocOpts;
26 typedef QTAILQ_HEAD(MemList, MemBlock) MemList;
28 typedef struct QGuestAllocator {
29 QAllocOpts opts;
30 uint64_t start;
31 uint64_t end;
32 uint32_t page_size;
34 MemList *used;
35 MemList *free;
36 } QGuestAllocator;
38 /* Always returns page aligned values */
39 uint64_t guest_alloc(QGuestAllocator *allocator, size_t size);
40 void guest_free(QGuestAllocator *allocator, uint64_t addr);
41 void migrate_allocator(QGuestAllocator *src, QGuestAllocator *dst);
43 void alloc_set_flags(QGuestAllocator *allocator, QAllocOpts opts);
45 void alloc_init(QGuestAllocator *alloc, QAllocOpts flags,
46 uint64_t start, uint64_t end,
47 size_t page_size);
48 void alloc_destroy(QGuestAllocator *allocator);
50 #endif