static int fill_note_info(struct elf_note_info *info,

    long signr, const CPUState *env)

{

#define NUMNOTES 3

    CPUState *cpu = NULL;

    TaskState *ts = (TaskState *)env->opaque;

    int i;



    (void) memset(info, 0, sizeof (*info));



    TAILQ_INIT(&info->thread_list);



    info->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote));

    if (info->notes == NULL)

        return (-ENOMEM);

    info->prstatus = qemu_mallocz(sizeof (*info->prstatus));

    if (info->prstatus == NULL)

        return (-ENOMEM);

    info->psinfo = qemu_mallocz(sizeof (*info->psinfo));

    if (info->prstatus == NULL)

        return (-ENOMEM);



    /*

     * First fill in status (and registers) of current thread

     * including process info & aux vector.

     */

    fill_prstatus(info->prstatus, ts, signr);

    elf_core_copy_regs(&info->prstatus->pr_reg, env);

    fill_note(&info->notes[0], "CORE", NT_PRSTATUS,

        sizeof (*info->prstatus), info->prstatus);

    fill_psinfo(info->psinfo, ts);

    fill_note(&info->notes[1], "CORE", NT_PRPSINFO,

        sizeof (*info->psinfo), info->psinfo);

    fill_auxv_note(&info->notes[2], ts);

    info->numnote = 3;



    info->notes_size = 0;

    for (i = 0; i < info->numnote; i++)

        info->notes_size += note_size(&info->notes[i]);



    /* read and fill status of all threads */

    cpu_list_lock();

    for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {

        if (cpu == thread_env)

            continue;

        fill_thread_info(info, cpu);

    }

    cpu_list_unlock();



    return (0);

}

static int fill_note_info(struct elf_note_info *info,

    long signr, const CPUState *env)

{

#define NUMNOTES 3

    CPUState *cpu = NULL;

    TaskState *ts = (TaskState *)env->opaque;

    int i;



    (void) memset(info, 0, sizeof (*info));



    TAILQ_INIT(&info->thread_list);



    info->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote));

    if (info->notes == NULL)

        return (-ENOMEM);

    info->prstatus = qemu_mallocz(sizeof (*info->prstatus));

    if (info->prstatus == NULL)

        return (-ENOMEM);

    info->psinfo = qemu_mallocz(sizeof (*info->psinfo));

    if (info->prstatus == NULL)

        return (-ENOMEM);



    







    fill_prstatus(info->prstatus, ts, signr);

    elf_core_copy_regs(&info->prstatus->pr_reg, env);

    fill_note(&info->notes[0], "CORE", NT_PRSTATUS,

        sizeof (*info->prstatus), info->prstatus);

    fill_psinfo(info->psinfo, ts);

    fill_note(&info->notes[1], "CORE", NT_PRPSINFO,

        sizeof (*info->psinfo), info->psinfo);

    fill_auxv_note(&info->notes[2], ts);

    info->numnote = 3;



    info->notes_size = 0;

    for (i = 0; i < info->numnote; i++)

        info->notes_size += note_size(&info->notes[i]);



    

    cpu_list_lock();

    for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {

        if (cpu == thread_env)

            continue;

        fill_thread_info(info, cpu);

    }

    cpu_list_unlock();



    return (0);

}

static int FUNC_0(struct elf_note_info *VAR_0,

    long VAR_1, const CPUState *VAR_2)

{

#define NUMNOTES 3

    CPUState *cpu = NULL;

    TaskState *ts = (TaskState *)VAR_2->opaque;

    int VAR_3;



    (void) memset(VAR_0, 0, sizeof (*VAR_0));



    TAILQ_INIT(&VAR_0->thread_list);



    VAR_0->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote));

    if (VAR_0->notes == NULL)

        return (-ENOMEM);

    VAR_0->prstatus = qemu_mallocz(sizeof (*VAR_0->prstatus));

    if (VAR_0->prstatus == NULL)

        return (-ENOMEM);

    VAR_0->psinfo = qemu_mallocz(sizeof (*VAR_0->psinfo));

    if (VAR_0->prstatus == NULL)

        return (-ENOMEM);



    







    fill_prstatus(VAR_0->prstatus, ts, VAR_1);

    elf_core_copy_regs(&VAR_0->prstatus->pr_reg, VAR_2);

    fill_note(&VAR_0->notes[0], "CORE", NT_PRSTATUS,

        sizeof (*VAR_0->prstatus), VAR_0->prstatus);

    fill_psinfo(VAR_0->psinfo, ts);

    fill_note(&VAR_0->notes[1], "CORE", NT_PRPSINFO,

        sizeof (*VAR_0->psinfo), VAR_0->psinfo);

    fill_auxv_note(&VAR_0->notes[2], ts);

    VAR_0->numnote = 3;



    VAR_0->notes_size = 0;

    for (VAR_3 = 0; VAR_3 < VAR_0->numnote; VAR_3++)

        VAR_0->notes_size += note_size(&VAR_0->notes[VAR_3]);



    

    cpu_list_lock();

    for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {

        if (cpu == thread_env)

            continue;

        fill_thread_info(VAR_0, cpu);

    }

    cpu_list_unlock();



    return (0);

}

static int FUNC_0(struct elf_note_info *VAR_0,
long VAR_1, const CPUState *VAR_2)
{ #define NUMNOTES 3
CPUState *cpu = NULL; TaskState *ts = (TaskState *)VAR_2->opaque; int VAR_3; (void) memset(VAR_0, 0, sizeof (*VAR_0)); TAILQ_INIT(&VAR_0->thread_list); VAR_0->notes = qemu_mallocz(NUMNOTES * sizeof (struct memelfnote)); if (VAR_0->notes == NULL)
return (-ENOMEM); VAR_0->prstatus = qemu_mallocz(sizeof (*VAR_0->prstatus)); if (VAR_0->prstatus == NULL)
return (-ENOMEM); VAR_0->psinfo = qemu_mallocz(sizeof (*VAR_0->psinfo)); if (VAR_0->prstatus == NULL)
return (-ENOMEM); fill_prstatus(VAR_0->prstatus, ts, VAR_1); elf_core_copy_regs(&VAR_0->prstatus->pr_reg, VAR_2); fill_note(&VAR_0->notes[0], "CORE", NT_PRSTATUS,
sizeof (*VAR_0->prstatus), VAR_0->prstatus); fill_psinfo(VAR_0->psinfo, ts); fill_note(&VAR_0->notes[1], "CORE", NT_PRPSINFO,
sizeof (*VAR_0->psinfo), VAR_0->psinfo); fill_auxv_note(&VAR_0->notes[2], ts); VAR_0->numnote = 3; VAR_0->notes_size = 0; for (VAR_3 = 0; VAR_3 < VAR_0->numnote; VAR_3++) VAR_0->notes_size += note_size(&VAR_0->notes[VAR_3]); cpu_list_lock(); for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) { if (cpu == thread_env)
continue; fill_thread_info(VAR_0, cpu); } cpu_list_unlock(); return (0); }