qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv2 6/6] dump: fix memory region handling


From: Rabin Vincent
Subject: Re: [Qemu-devel] [PATCHv2 6/6] dump: fix memory region handling
Date: Sun, 24 Mar 2013 20:35:51 +0100

2013/3/24 Peter Maydell <address@hidden>:
> On 24 March 2013 17:27, Rabin Vincent <address@hidden> wrote:
>>  /**
>> + * memory_region_get_addr: Get the address of a memory region
>> + *
>> + * @mr: the memory region
>> + */
>> +hwaddr memory_region_get_addr(MemoryRegion *mr);
>
> I'm afraid this doesn't make sense. A MemoryRegion by itself has
> no "address" -- it could be mapped into several places in several
> different address maps or none at all.

OK.  Do you mean that such a function can be used internally to the dump
code where it gets the MemoryRegion only from the RAMBlock.mr or do you
mean the dump code also shouldn't be doing it that way?

If you mean the latter, could you please suggest an alternative way to
handle this?  The problem is that the dump code assumes that
RAMBlock.offset provides the physical address, and this appears to not
be the case.  For example, with a dump generated from vexpress I get
these Program Headers in the dump:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  NOTE           0x0000f4 0x00000000 0x00000000 0x002a0 0x002a0     0
  LOAD           0x000394 0x00000000 0x00000000 0x8000000 0x8000000     0
  LOAD           0x8000394 0x00000000 0x08000000 0x4000000 0x4000000     0
  LOAD           0xc000394 0x00000000 0x0c000000 0x4000000 0x4000000     0
  LOAD           0x10000394 0x00000000 0x10000000 0x2000000 0x2000000     0
  LOAD           0x12000394 0x00000000 0x12000000 0x800000 0x800000     0

The physical addresses are completely wrong, and with the patch I get
the right ones:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  NOTE           0x0000f4 0x00000000 0x00000000 0x002a0 0x002a0     0
  LOAD           0x8000394 0x00000000 0x40000000 0x4000000 0x4000000     0
  LOAD           0xc000394 0x00000000 0x44000000 0x4000000 0x4000000     0
  LOAD           0x10000394 0x00000000 0x48000000 0x2000000 0x2000000     0
  LOAD           0x12000394 0x00000000 0x4c000000 0x800000 0x800000     0
  LOAD           0x000394 0x00000000 0x60000000 0x8000000 0x8000000     0

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]