]> Git Repo - qemu.git/blame - tests/libqos/malloc.h
libqos: Add support for memory-mapped fw_cfg
[qemu.git] / tests / libqos / malloc.h
CommitLineData
8a0743cf
AL
1/*
2 * libqos malloc support
3 *
4 * Copyright IBM, Corp. 2012-2013
5 *
6 * Authors:
7 * Anthony Liguori <[email protected]>
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>
18
19typedef struct QGuestAllocator QGuestAllocator;
20
21struct QGuestAllocator
22{
23 uint64_t (*alloc)(QGuestAllocator *allocator, size_t size);
24 void (*free)(QGuestAllocator *allocator, uint64_t addr);
25};
26
27/* Always returns page aligned values */
28static inline uint64_t guest_alloc(QGuestAllocator *allocator, size_t size)
29{
30 return allocator->alloc(allocator, size);
31}
32
33static inline void guest_free(QGuestAllocator *allocator, uint64_t addr)
34{
35 allocator->alloc(allocator, addr);
36}
37
38#endif
This page took 0.058432 seconds and 4 git commands to generate.