aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-20 22:09:37 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-20 23:01:08 -0500
commit7267c0947d7e8ae5dff7bafd932c3bc285f43e5c (patch)
tree9aa05d6e05ed83e67bf014f6745a3081b8407dc5 /hw/pc.c
parent14015304b662e8f8ccce46c5a6927af6a14c510b (diff)
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 4b07b35e09..7be60a4a08 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -617,7 +617,7 @@ static void *bochs_bios_init(void)
* of nodes, one word for each VCPU->node and one word for each node to
* hold the amount of memory.
*/
- numa_fw_cfg = qemu_mallocz((1 + smp_cpus + nb_numa_nodes) * 8);
+ numa_fw_cfg = g_malloc0((1 + smp_cpus + nb_numa_nodes) * 8);
numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes);
for (i = 0; i < smp_cpus; i++) {
for (j = 0; j < nb_numa_nodes; j++) {
@@ -788,7 +788,7 @@ static void load_linux(void *fw_cfg,
initrd_addr = (initrd_max-initrd_size) & ~4095;
- initrd_data = qemu_malloc(initrd_size);
+ initrd_data = g_malloc(initrd_size);
load_image(initrd_filename, initrd_data);
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_addr);
@@ -806,8 +806,8 @@ static void load_linux(void *fw_cfg,
setup_size = (setup_size+1)*512;
kernel_size -= setup_size;
- setup = qemu_malloc(setup_size);
- kernel = qemu_malloc(kernel_size);
+ setup = g_malloc(setup_size);
+ kernel = g_malloc(kernel_size);
fseek(f, 0, SEEK_SET);
if (fread(setup, 1, setup_size, f) != setup_size) {
fprintf(stderr, "fread() failed\n");
@@ -978,15 +978,15 @@ void pc_memory_init(MemoryRegion *system_memory,
* aliases to address portions of it, mostly for backwards compatiblity
* with older qemus that used qemu_ram_alloc().
*/
- ram = qemu_malloc(sizeof(*ram));
+ ram = g_malloc(sizeof(*ram));
memory_region_init_ram(ram, NULL, "pc.ram",
below_4g_mem_size + above_4g_mem_size);
- ram_below_4g = qemu_malloc(sizeof(*ram_below_4g));
+ ram_below_4g = g_malloc(sizeof(*ram_below_4g));
memory_region_init_alias(ram_below_4g, "ram-below-4g", ram,
0, below_4g_mem_size);
memory_region_add_subregion(system_memory, 0, ram_below_4g);
if (above_4g_mem_size > 0) {
- ram_above_4g = qemu_malloc(sizeof(*ram_above_4g));
+ ram_above_4g = g_malloc(sizeof(*ram_above_4g));
memory_region_init_alias(ram_above_4g, "ram-above-4g", ram,
below_4g_mem_size, above_4g_mem_size);
memory_region_add_subregion(system_memory, 0x100000000ULL,
@@ -1006,7 +1006,7 @@ void pc_memory_init(MemoryRegion *system_memory,
(bios_size % 65536) != 0) {
goto bios_error;
}
- bios = qemu_malloc(sizeof(*bios));
+ bios = g_malloc(sizeof(*bios));
memory_region_init_ram(bios, NULL, "pc.bios", bios_size);
memory_region_set_readonly(bios, true);
ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
@@ -1016,13 +1016,13 @@ void pc_memory_init(MemoryRegion *system_memory,
exit(1);
}
if (filename) {
- qemu_free(filename);
+ g_free(filename);
}
/* map the last 128KB of the BIOS in ISA space */
isa_bios_size = bios_size;
if (isa_bios_size > (128 * 1024))
isa_bios_size = 128 * 1024;
- isa_bios = qemu_malloc(sizeof(*isa_bios));
+ isa_bios = g_malloc(sizeof(*isa_bios));
memory_region_init_alias(isa_bios, "isa-bios", bios,
bios_size - isa_bios_size, isa_bios_size);
memory_region_add_subregion_overlap(system_memory,
@@ -1031,7 +1031,7 @@ void pc_memory_init(MemoryRegion *system_memory,
1);
memory_region_set_readonly(isa_bios, true);
- option_rom_mr = qemu_malloc(sizeof(*option_rom_mr));
+ option_rom_mr = g_malloc(sizeof(*option_rom_mr));
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE);
memory_region_add_subregion_overlap(system_memory,
PC_ROM_MIN_VGA,