[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC][PATCH 08/16 v6] target-i386: add API to get dump
From: |
Wen Congyang |
Subject: |
Re: [Qemu-devel] [RFC][PATCH 08/16 v6] target-i386: add API to get dump info |
Date: |
Wed, 15 Feb 2012 17:19:23 +0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 |
At 02/15/2012 05:12 PM, Peter Maydell Wrote:
> On 9 February 2012 03:26, Wen Congyang <address@hidden> wrote:
>> +int cpu_get_dump_info(ArchDumpInfo *info)
>> +{
>> + bool lma = false;
>> + RAMBlock *block;
>> +
>> +#ifdef TARGET_X86_64
>> + lma = !!(first_cpu->hflags & HF_LMA_MASK);
>> +#endif
>> +
>> + if (lma) {
>> + info->d_machine = EM_X86_64;
>> + } else {
>> + info->d_machine = EM_386;
>> + }
>> + info->d_endian = ELFDATA2LSB;
>> +
>> + if (lma) {
>> + info->d_class = ELFCLASS64;
>> + } else {
>> + info->d_class = ELFCLASS32;
>> + }
>> +
>> + QLIST_FOREACH(block, &ram_list.blocks, next) {
>> + if (!lma && (block->offset + block->length > UINT_MAX)) {
>> + /* The memory size is greater than 4G */
>> + info->d_class = ELFCLASS32;
>> + break;
>> + }
>> + }
>
> I think it would be cleaner to have a single
> if (lma) {
> stuff;
> } else {
> stuff;
> }
>
> rather than checking it three times, especially for
> the loop, where if lma is true we'll walk the ram_list
> without ever doing anything.
Nice. I will change it.
Thanks
Wen Congyang
>
> -- PMM
>
- Re: [Qemu-devel] [RFC][PATCH 07/16 v6] target-i386: Add API to add extra memory mapping, (continued)
[Qemu-devel] [RFC][PATCH 08/16 v6] target-i386: add API to get dump info, Wen Congyang, 2012/02/08
Re: [Qemu-devel] [RFC][PATCH 08/16 v6] target-i386: add API to get dump info, Peter Maydell, 2012/02/15
- Re: [Qemu-devel] [RFC][PATCH 08/16 v6] target-i386: add API to get dump info,
Wen Congyang <=
[Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Wen Congyang, 2012/02/08
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Jan Kiszka, 2012/02/14
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Wen Congyang, 2012/02/14
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Wen Congyang, 2012/02/17
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Jan Kiszka, 2012/02/17
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Wen Congyang, 2012/02/17
- Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Jan Kiszka, 2012/02/17
Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Eric Blake, 2012/02/17
Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Jan Kiszka, 2012/02/17
Re: [Qemu-devel] [RFC][PATCH 09/16 v6] introduce a new monitor command 'dump' to dump guest's memory, Eric Blake, 2012/02/17