On Thu, Aug 23, 2012 at 8:52 AM, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 23 August 2012 16:34, Xin Tong <xerox.time.t...@gmail.com> wrote: >> I am emulating arm on x86. i want to track the virt and physical >> address of last memory operation. so i put 2 fields in the CPUState >> and make tcg_global_mem_new_i32 on them Therefore, before every >> translation i generate code to save the virtual address as follow: >> >> static inline void gen_st32(TCGv val, TCGv addr, int index) >> { >> tcg_gen_mov_i32(cpu_last_vaddr, addr); >> tcg_gen_qemu_st32(val, addr, index); >> // tcg_gen_mov_i32(cpu_last_paddr, addr); >> tcg_temp_free_i32(val); >> } >> >> But i do not know how to save the physical, as the physical address is >> never passed out of tcg_gen_qemu_st32. what would be the best way to >> get the physical address here ? i want to pass it out by the "TCGv >> addr here" but it did not work ... > > This is quite difficult because our fast-path code doesn't actually > deal with the guest physical address at all: we create a TLB which > maps directly from guest virtual address to host virtual address > and use that most of the time. > > In general you are running into the problem that QEMU is designed > to run code fast, not to be easy to instrument.
even that. is it possible to pass host virtual out. the fast path add the addend to get host virtual ? so it must be in a register, most likely eax in i386. what do you think would be the best way to get that out ? Xin > > -- PMM