mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00
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>
This commit is contained in:
parent
14015304b6
commit
7267c0947d
357 changed files with 1672 additions and 1674 deletions
|
@ -1473,7 +1473,7 @@ static void load_elf_image(const char *image_name, int image_fd,
|
|||
#ifdef CONFIG_USE_FDPIC
|
||||
{
|
||||
struct elf32_fdpic_loadseg *loadsegs = info->loadsegs =
|
||||
qemu_malloc(sizeof(*loadsegs) * info->nsegs);
|
||||
g_malloc(sizeof(*loadsegs) * info->nsegs);
|
||||
|
||||
for (i = 0; i < ehdr->e_phnum; ++i) {
|
||||
switch (phdr[i].p_type) {
|
||||
|
@ -2063,7 +2063,7 @@ static struct mm_struct *vma_init(void)
|
|||
{
|
||||
struct mm_struct *mm;
|
||||
|
||||
if ((mm = qemu_malloc(sizeof (*mm))) == NULL)
|
||||
if ((mm = g_malloc(sizeof (*mm))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
mm->mm_count = 0;
|
||||
|
@ -2078,9 +2078,9 @@ static void vma_delete(struct mm_struct *mm)
|
|||
|
||||
while ((vma = vma_first(mm)) != NULL) {
|
||||
QTAILQ_REMOVE(&mm->mm_mmap, vma, vma_link);
|
||||
qemu_free(vma);
|
||||
g_free(vma);
|
||||
}
|
||||
qemu_free(mm);
|
||||
g_free(mm);
|
||||
}
|
||||
|
||||
static int vma_add_mapping(struct mm_struct *mm, abi_ulong start,
|
||||
|
@ -2088,7 +2088,7 @@ static int vma_add_mapping(struct mm_struct *mm, abi_ulong start,
|
|||
{
|
||||
struct vm_area_struct *vma;
|
||||
|
||||
if ((vma = qemu_mallocz(sizeof (*vma))) == NULL)
|
||||
if ((vma = g_malloc0(sizeof (*vma))) == NULL)
|
||||
return (-1);
|
||||
|
||||
vma->vma_start = start;
|
||||
|
@ -2412,7 +2412,7 @@ static void fill_thread_info(struct elf_note_info *info, const CPUState *env)
|
|||
TaskState *ts = (TaskState *)env->opaque;
|
||||
struct elf_thread_status *ets;
|
||||
|
||||
ets = qemu_mallocz(sizeof (*ets));
|
||||
ets = g_malloc0(sizeof (*ets));
|
||||
ets->num_notes = 1; /* only prstatus is dumped */
|
||||
fill_prstatus(&ets->prstatus, ts, 0);
|
||||
elf_core_copy_regs(&ets->prstatus.pr_reg, env);
|
||||
|
@ -2436,13 +2436,13 @@ static int fill_note_info(struct elf_note_info *info,
|
|||
|
||||
QTAILQ_INIT(&info->thread_list);
|
||||
|
||||
info->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote));
|
||||
info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote));
|
||||
if (info->notes == NULL)
|
||||
return (-ENOMEM);
|
||||
info->prstatus = qemu_mallocz(sizeof (*info->prstatus));
|
||||
info->prstatus = g_malloc0(sizeof (*info->prstatus));
|
||||
if (info->prstatus == NULL)
|
||||
return (-ENOMEM);
|
||||
info->psinfo = qemu_mallocz(sizeof (*info->psinfo));
|
||||
info->psinfo = g_malloc0(sizeof (*info->psinfo));
|
||||
if (info->prstatus == NULL)
|
||||
return (-ENOMEM);
|
||||
|
||||
|
@ -2483,12 +2483,12 @@ static void free_note_info(struct elf_note_info *info)
|
|||
while (!QTAILQ_EMPTY(&info->thread_list)) {
|
||||
ets = QTAILQ_FIRST(&info->thread_list);
|
||||
QTAILQ_REMOVE(&info->thread_list, ets, ets_link);
|
||||
qemu_free(ets);
|
||||
g_free(ets);
|
||||
}
|
||||
|
||||
qemu_free(info->prstatus);
|
||||
qemu_free(info->psinfo);
|
||||
qemu_free(info->notes);
|
||||
g_free(info->prstatus);
|
||||
g_free(info->psinfo);
|
||||
g_free(info->notes);
|
||||
}
|
||||
|
||||
static int write_note_info(struct elf_note_info *info, int fd)
|
||||
|
|
|
@ -3216,7 +3216,7 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
target_argv[target_argc] = NULL;
|
||||
|
||||
ts = qemu_mallocz (sizeof(TaskState));
|
||||
ts = g_malloc0 (sizeof(TaskState));
|
||||
init_task_state(ts);
|
||||
/* build Task State */
|
||||
ts->info = info;
|
||||
|
|
|
@ -3991,7 +3991,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
|
|||
new_thread_info info;
|
||||
pthread_attr_t attr;
|
||||
#endif
|
||||
ts = qemu_mallocz(sizeof(TaskState));
|
||||
ts = g_malloc0(sizeof(TaskState));
|
||||
init_task_state(ts);
|
||||
/* we create a new CPU instance. */
|
||||
new_env = cpu_copy(env);
|
||||
|
@ -4057,7 +4057,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
|
|||
if (flags & CLONE_NPTL_FLAGS2)
|
||||
return -EINVAL;
|
||||
/* This is probably going to die very quickly, but do it anyway. */
|
||||
new_stack = qemu_mallocz (NEW_STACK_SIZE);
|
||||
new_stack = g_malloc0 (NEW_STACK_SIZE);
|
||||
#ifdef __ia64__
|
||||
ret = __clone2(clone_func, new_stack, NEW_STACK_SIZE, flags, new_env);
|
||||
#else
|
||||
|
@ -4651,8 +4651,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
|||
NULL, NULL, 0);
|
||||
}
|
||||
thread_env = NULL;
|
||||
qemu_free(cpu_env);
|
||||
qemu_free(ts);
|
||||
g_free(cpu_env);
|
||||
g_free(ts);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue