At 03/01/2012 01:10 PM, HATAYAMA Daisuke Wrote: > From: Wen Congyang <we...@cn.fujitsu.com> > Subject: [RFC][PATCH 06/14 v7] target-i386: Add API to write cpu status to > core file > Date: Thu, 01 Mar 2012 10:48:17 +0800 > >> +int cpu_write_elf64_qemunote(write_core_dump_function f, CPUState *env, >> + target_phys_addr_t *offset, void *opaque) >> +{ >> + QEMUCPUState state; >> + Elf64_Nhdr *note; >> + char *buf; >> + int descsz, note_size, name_size = 5; >> + const char *name = "QEMU"; >> + int ret; >> + >> + qemu_get_cpustate(&state, env); >> + >> + descsz = sizeof(state); >> + note_size = ((sizeof(Elf32_Nhdr) + 3) / 4 + (name_size + 3) / 4 + >> + (descsz + 3) / 4) * 4; >> + note = g_malloc(note_size); >> + >> + memset(note, 0, note_size); >> + note->n_namesz = cpu_to_le32(name_size); >> + note->n_descsz = cpu_to_le32(descsz); >> + note->n_type = 0; >> + buf = (char *)note; >> + buf += ((sizeof(Elf32_Nhdr) + 3) / 4) * 4; >> + memcpy(buf, name, name_size); >> + buf += ((name_size + 3) / 4) * 4; >> + memcpy(buf, &state, sizeof(state)); > > x86_64_write_elf64_note() and x86_write_elf64_note() does the same > processing for note data. Is it better to do this in helper functions > in common?
I forgot to merge them. I will fix it. Thanks Wen Congyang > > Thanks. > HATAYAMA, Daisuke > >