On Fri, Nov 26, 2010 at 3:25 AM, Teng-Feng Yang <[email protected]>wrote:

> Hi
>
> I have worked on PTLsim for nearly a year, and now I am starting to trace
> the code of MARSSx86 recently.
> I am wondering how the trace used for translation in fetch stage been
> transfered from QEMU to PTLsim.
> In my understanding, the *BasicBlockCache::translate* calls *
> TraceDecoder::fillbuf* to fill the *insnbuf, *and the *
> TraceDecoder::fillbuf* will call *ctx.copy_from_user* to get the x86
> instruction of this basic block. *
> *
>
> The first question is what is the purpose of* *calculating the physical
> address in *ctx.copy_from_user?*
> It seems that the *ctx.copy_from_user *does not make use of the physical
> address to get the x86 instruction of the basic block.*
> *
>

Yes, ctx.copy_from_user uses QEMU functions ldub_code and ldub_kernel to
directly load/copy the instructions, so it doesn't need to convert virtual
address to physical address.

>
> The *ctx.copy_from_user *directly copy the data with the virtual address
> rip by calling *ldub_code* or *ldub_kernel.*
> Does *ldub_code* or *ldub_kernel *can only be used under user mode of
> MARSSx86?
> (The comment of *ldub_code* or *ldub_kernel* says " if user mode, no other
> memory access functions")
>
> In Marss, we use QEMU with 'CONFIG_USER_ONLY' as undefined. Marss uses QEMU
as full-system emulator so it uses soft-mmu methods to access memory from
virtual machine. So the comment you mentioned about ldub_code or ldub_kernel
does not apply in Marss.

If you are trying to find the ldub_code or other functions, look at
'softmmu_header.h' file.  QEMU heavily uses C Macros to mimic C++ templates,
so actually the ldub_code function is generated by compiler when this
'softmmu_header.h' file is included via 'exec-all.h' file (look from line
283 to 300 in 'exec-all.h').

- Avadh

> Any help would be grateful!
>
> Thanks!
>
> Teng-Feng
>
>
>
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel

Reply via email to