qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qemu log function to print out the registers of the gue


From: Max Filippov
Subject: Re: [Qemu-devel] qemu log function to print out the registers of the guest
Date: Thu, 16 Aug 2012 21:43:26 +0400

On Thu, Aug 16, 2012 at 9:37 PM, Max Filippov <address@hidden> wrote:
> On Thu, Aug 16, 2012 at 9:29 PM, Steven <address@hidden> wrote:
>> On Thu, Aug 16, 2012 at 1:00 PM, Max Filippov <address@hidden> wrote:
>>> On Thu, Aug 16, 2012 at 8:36 PM, Steven <address@hidden> wrote:
>>>> On Thu, Aug 16, 2012 at 4:02 AM, 陳韋任 (Wei-Ren Chen)
>>>> <address@hidden> wrote:
>>>>>> I would like to is there any function that could log the register
>>>>>> content of the guest machine, like "info registers" in the qemu
>>>>>> monitor mode.
>>>>>
>>>>>   Why not check how "info registes" be implemented in QEMU? ;)
>>>>> I guess you just have to log env->regs or something like that.
>>>> Thanks for pointing this out.
>>>> I would like to get a trace of guest memory access. So I can not use
>>>> "info registers".
>>>> What I want to do is that when tcg fetches a load instruction at
>>>> disas_insns(), the guest memory address should be calculated. For
>>>
>>> No, you don't want this, because the same translated code may be
>>> invoked multiple times with different values in registers.
>>>
>>>> example, the tb has an instruction of mov 0x4(%ebx)  %eax.
>>>> To calculate the address of 0x4(%ebx), I need to know the value of %ebx.
>>>> Is this correct? Thanks.
>>>
>>> Why don't you just instrument actual memory access functions in
>>> softmmu_template.h ?
>> But this code only touches the s->pc. For registers in the load
>> instruction, it won't generate the memory access code. So I need to
>> add code to some function to get the guest memory address access.
>
> Take a close look at
>
> DATA_TYPE
> glue(glue(glue(HELPER_PREFIX, ld), SUFFIX), MMUSUFFIX)(ENV_PARAM
>                                                        target_ulong addr,
>                                                        int mmu_idx)
>
> and
>
> void glue(glue(glue(HELPER_PREFIX, st), SUFFIX), MMUSUFFIX)(ENV_PARAM
>                                                             target_ulong addr,
>                                                             DATA_TYPE val,
>                                                             int mmu_idx)
>
> At runtime they get addr, this is the virtual address of the memory access.
> This file is included several times to instantiate these functions for
> different memory access types.
> A set of macros manipulates access size and whether it is code or data access.

But maybe I got you wrong and by

  What I want to do is that when tcg fetches a load instruction at
  disas_insns(), the guest memory address should be calculated.

you meant that you need to record code address that made an access,
not the accessed data address?

-- 
Thanks.
-- Max



reply via email to

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