Re: [Qemu-devel] ARM: Virtual / Physical address translation

2012-06-04 Thread Laurent Desnogues
On Thu, May 31, 2012 at 9:07 PM, Ira Ray Jenkins
irarayjenk...@gmail.com wrote:
 On Wed, May 30, 2012 at 10:30 AM, Laurent Desnogues
 laurent.desnog...@gmail.com wrote:
 On Wed, May 30, 2012 at 3:20 AM, Peter Maydell peter.mayd...@linaro.org 
 wrote:
 On 30 May 2012 02:00, Ira Ray Jenkins irarayjenk...@gmail.com wrote:
 What I would like is to be able to get the physical addresses of both
 data and instructions. Can anyone help me work through how to get the
 properly translated physical addresses given the virtual address?

 See the function get_phys_addr() in target-arm/helper.c ... That is
 a private function but if you're doing a local hack you can wire
 it up to what you need it for.

 Using that function directly is not that great an idea as it has
 side effects on the environment.  IMHO the best is to duplicate
 it and remove the side effects (which is what I did for my
 cache simulator).

 BTW Edgar Iglesias has implemented a cache simulator in
 QEMU.  I just can't remember where the repository is...


 Laurent

 Would I also need to duplicate get_phys_addr_mpu/v5/v6 ?

Depending on the target CPU, you'd have to duplicate one of them.

 The side effects you mentioned, are these in the above functions?

I was wrong in my previous mail:  the changes to env are done
in cpu_arm_handle_mmu_fault which is the entry point to handle
VA/PA translation from generated code.

 Since I'm really only interested in the physical address - phys_ptr -
 , can I ignore protection  page size? What about access type and
 user?

You don't need to return these values.  But be careful about
translations that fault:  if you insert your helper call before the
code for the emulated ld/st, you can get faults and in this
case you probably don't want to log that memory access.

 Edgar's work was for the cris target, so I'm unsure if it is different
 for arm.

The way it's done should be similar.

 Basically, since I am just doing a memory trace dump for arm
 target, I just want a simple translation from virtual address to
 physical, unobtrusively - without modify the state/env. I'm not sure
 how to modify get_phys_addr*() to do this. Any help would be great.

I hope you have enough information now.


Laurent



Re: [Qemu-devel] ARM: Virtual / Physical address translation

2012-05-31 Thread Ira Ray Jenkins
On Wed, May 30, 2012 at 10:30 AM, Laurent Desnogues
laurent.desnog...@gmail.com wrote:
 On Wed, May 30, 2012 at 3:20 AM, Peter Maydell peter.mayd...@linaro.org 
 wrote:
 On 30 May 2012 02:00, Ira Ray Jenkins irarayjenk...@gmail.com wrote:
 What I would like is to be able to get the physical addresses of both
 data and instructions. Can anyone help me work through how to get the
 properly translated physical addresses given the virtual address?

 See the function get_phys_addr() in target-arm/helper.c ... That is
 a private function but if you're doing a local hack you can wire
 it up to what you need it for.

 Using that function directly is not that great an idea as it has
 side effects on the environment.  IMHO the best is to duplicate
 it and remove the side effects (which is what I did for my
 cache simulator).

 BTW Edgar Iglesias has implemented a cache simulator in
 QEMU.  I just can't remember where the repository is...


 Laurent

Would I also need to duplicate get_phys_addr_mpu/v5/v6 ?

The side effects you mentioned, are these in the above functions?

Since I'm really only interested in the physical address - phys_ptr -
, can I ignore protection  page size? What about access type and
user?

Edgar's work was for the cris target, so I'm unsure if it is different
for arm. Basically, since I am just doing a memory trace dump for arm
target, I just want a simple translation from virtual address to
physical, unobtrusively - without modify the state/env. I'm not sure
how to modify get_phys_addr*() to do this. Any help would be great.



Re: [Qemu-devel] ARM: Virtual / Physical address translation

2012-05-30 Thread Laurent Desnogues
On Wed, May 30, 2012 at 3:20 AM, Peter Maydell peter.mayd...@linaro.org wrote:
 On 30 May 2012 02:00, Ira Ray Jenkins irarayjenk...@gmail.com wrote:
 What I would like is to be able to get the physical addresses of both
 data and instructions. Can anyone help me work through how to get the
 properly translated physical addresses given the virtual address?

 See the function get_phys_addr() in target-arm/helper.c ... That is
 a private function but if you're doing a local hack you can wire
 it up to what you need it for.

Using that function directly is not that great an idea as it has
side effects on the environment.  IMHO the best is to duplicate
it and remove the side effects (which is what I did for my
cache simulator).

BTW Edgar Iglesias has implemented a cache simulator in
QEMU.  I just can't remember where the repository is...


Laurent



[Qemu-devel] ARM: Virtual / Physical address translation

2012-05-29 Thread Ira Ray Jenkins
I am working on a qemu modification that would output memory traces in
a format acceptable to Dinero IV. I've seen some previous proto-type
work done on this with mips and x86, but I am specifically interested
in arm. Currently, I am able to dump the virtual address of all ld/st
instructions. I believe I am on the right track for instruction
fetches, just dumping the pc at translation time - should give me the
virtual address of the current instruction. I previously tried dumping
r15 - the pc for arm - but it wasn't always updated for every
instruction.

What I would like is to be able to get the physical addresses of both
data and instructions. Can anyone help me work through how to get the
properly translated physical addresses given the virtual address? If
there isn't an api/function call that does the translation, it would
be nice to have a helper function like:

uint64_t gen_helper_virtual_to_physical_translation(uint64_t virtualAddr)

I'm not sure it needs to be a defined helper function, but I'm
familiar with generating those, so it makes sense like that...

Thanks for any help,



Re: [Qemu-devel] ARM: Virtual / Physical address translation

2012-05-29 Thread Peter Maydell
On 30 May 2012 02:00, Ira Ray Jenkins irarayjenk...@gmail.com wrote:
 What I would like is to be able to get the physical addresses of both
 data and instructions. Can anyone help me work through how to get the
 properly translated physical addresses given the virtual address?

See the function get_phys_addr() in target-arm/helper.c ... That is
a private function but if you're doing a local hack you can wire
it up to what you need it for.

-- PMM