void pc_init_pci(QEMUMachineInitArgs *args);
extern MemoryRegion *global_ram_memory;
-extern void *preallocated_ptr;
+extern void *preallocated_ram_ptr;
#endif
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
/* allocate ram and load rom/bios */
if (!xen_enabled()) {
-#ifdef CONFIG_MARU
- // W/A for allocate larger continuous heap.
- // see vl.c
- if(preallocated_ptr != NULL) {
- g_free(preallocated_ptr);
- }
-#endif
fw_cfg = pc_memory_init(system_memory,
args->kernel_filename, args->kernel_cmdline,
args->initrd_filename,
return ptr;
}
+#ifdef CONFIG_MARU
+void *preallocated_ram_ptr = NULL;
+#endif
/* alloc shared memory pages */
void *qemu_anon_ram_alloc(size_t size)
{
+#ifdef CONFIG_MARU
+ if (preallocated_ram_ptr) {
+ return preallocated_ram_ptr;
+ }
+#endif
size_t align = QEMU_VMALLOC_ALIGN;
size_t total = size + align - getpagesize();
void *ptr = mmap(0, total, PROT_READ | PROT_WRITE,
return ptr;
}
+#ifdef CONFIG_MARU
+void *preallocated_ram_ptr = NULL;
+#endif
void *qemu_anon_ram_alloc(size_t size)
{
void *ptr;
/* FIXME: this is not exactly optimal solution since VirtualAlloc
has 64Kb granularity, but at least it guarantees us that the
memory is page aligned. */
+#ifdef CONFIG_MARU
+ if (preallocated_ram_ptr) {
+ return preallocated_ram_ptr;
+ }
+#endif
ptr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
trace_qemu_anon_ram_alloc(size, ptr);
return ptr;
#ifdef CONFIG_MARU
int use_qemu_display = 0; //0:use tizen qemu sdl, 1:use original qemu sdl
+
// W/A for preserve larger continuous heap for RAM.
-void *preallocated_ptr = 0;
+extern void *preallocated_ram_ptr;
#endif
int main(int argc, char **argv, char **envp)
}
#if defined(CONFIG_MARU)
- // W/A for preserve larger continuous heap for RAM.
- preallocated_ptr = g_malloc(ram_size);
+ preallocated_ram_ptr = qemu_anon_ram_alloc(ram_size);
kernel_cmdline = qemu_opt_get(qemu_get_machine_opts(), "append");
// Returned variable points different address from input variable.