From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2ySO-0002Vm-S2 for qemu-devel@nongnu.org; Thu, 01 Mar 2012 00:21:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2yS3-0005yE-9x for qemu-devel@nongnu.org; Thu, 01 Mar 2012 00:21:36 -0500 Received: from [222.73.24.84] (port=63519 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2yS2-0005xV-Vo for qemu-devel@nongnu.org; Thu, 01 Mar 2012 00:21:15 -0500 Message-ID: <4F4F0791.50500@cn.fujitsu.com> Date: Thu, 01 Mar 2012 13:22:25 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4F4EE080.9060307@cn.fujitsu.com> <4F4EE371.6000601@cn.fujitsu.com> <20120301.141030.246502741.d.hatayama@jp.fujitsu.com> In-Reply-To: <20120301.141030.246502741.d.hatayama@jp.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [RFC][PATCH 06/14 v7] target-i386: Add API to write cpu status to core file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: HATAYAMA Daisuke Cc: jan.kiszka@siemens.com, anderson@redhat.com, qemu-devel@nongnu.org, eblake@redhat.com, lcapitulino@redhat.com At 03/01/2012 01:10 PM, HATAYAMA Daisuke Wrote: > From: Wen Congyang > 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 > >