s390x: upgrade status of KVM cores to "supported"
[qemu/ar7.git] / tests / libqos / malloc-pc.c
blobb83cb8f0afdef7f7f814f1812932be1d63d20b03
1 /*
2 * libqos malloc support for PC
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 #include "qemu/osdep.h"
14 #include "libqos/malloc-pc.h"
15 #include "libqos/fw_cfg.h"
17 #include "standard-headers/linux/qemu_fw_cfg.h"
19 #include "qemu-common.h"
21 #define PAGE_SIZE (4096)
24 * Mostly for valgrind happiness, but it does offer
25 * a chokepoint for debugging guest memory leaks, too.
27 void pc_alloc_uninit(QGuestAllocator *allocator)
29 alloc_uninit(allocator);
32 QGuestAllocator *pc_alloc_init_flags(QTestState *qts, QAllocOpts flags)
34 QGuestAllocator *s;
35 uint64_t ram_size;
36 QFWCFG *fw_cfg = pc_fw_cfg_init(qts);
38 ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
39 s = alloc_init_flags(flags, 1 << 20, MIN(ram_size, 0xE0000000));
40 alloc_set_page_size(s, PAGE_SIZE);
42 /* clean-up */
43 g_free(fw_cfg);
45 return s;
48 inline QGuestAllocator *pc_alloc_init(QTestState *qts)
50 return pc_alloc_init_flags(qts, ALLOC_NO_FLAGS);