]> git.proxmox.com Git - mirror_qemu.git/blob - tests/libqos/malloc-pc.c
qdev: add qdev_add_vm_change_state_handler()
[mirror_qemu.git] / tests / libqos / malloc-pc.c
1 /*
2 * libqos malloc support for PC
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 #include "qemu/osdep.h"
14 #include "libqos/malloc-pc.h"
15 #include "libqos/fw_cfg.h"
16
17 #include "standard-headers/linux/qemu_fw_cfg.h"
18
19 #include "qemu-common.h"
20
21 #define PAGE_SIZE (4096)
22
23 void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags)
24 {
25 uint64_t ram_size;
26 QFWCFG *fw_cfg = pc_fw_cfg_init(qts);
27
28 ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
29 alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE);
30
31 /* clean-up */
32 pc_fw_cfg_uninit(fw_cfg);
33 }