]>
Commit | Line | Data |
---|---|---|
8a0743cf AL |
1 | /* |
2 | * libqos malloc support for PC | |
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 | ||
681c28a3 | 13 | #include "qemu/osdep.h" |
8a0743cf | 14 | #include "libqos/malloc-pc.h" |
26491a38 | 15 | #include "libqos/fw_cfg.h" |
8a0743cf | 16 | |
5be5df72 | 17 | #include "standard-headers/linux/qemu_fw_cfg.h" |
8a0743cf AL |
18 | |
19 | #include "qemu-common.h" | |
8a0743cf AL |
20 | |
21 | #define PAGE_SIZE (4096) | |
22 | ||
eb5937ba | 23 | void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags) |
8a0743cf | 24 | { |
8a0743cf | 25 | uint64_t ram_size; |
05e520f1 | 26 | QFWCFG *fw_cfg = pc_fw_cfg_init(qts); |
8a0743cf AL |
27 | |
28 | ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE); | |
eb5937ba | 29 | alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE); |
8a0743cf | 30 | |
f3cdcbae | 31 | /* clean-up */ |
65461d12 | 32 | pc_fw_cfg_uninit(fw_cfg); |
ec2f1605 | 33 | } |