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 ... Xin 0xf3753166: mov eax,DWORD PTR [ebp+0x18] 0xf3753169: mov edx,eax 0xf375316b: mov ecx,eax 0xf375316d: mov DWORD PTR [ebp+0x6ccc],eax 0xf3753173: mov DWORD PTR [ebp+0x3d4],edx 0xf3753179: mov eax,0x4 0xf375317e: mov DWORD PTR [ebp+0x3dc],eax 0xf3753184: xor eax,eax 0xf3753186: mov DWORD PTR [ebp+0x3e0],eax 0xf375318c: mov edx,ecx 0xf375318e: mov eax,ecx 0xf3753190: shr edx,0x6 0xf3753193: and eax,0xfffffc03 0xf3753199: and edx,0xff0 0xf375319f: lea edx,[ebp+edx*1+0x4c4] 0xf37531a6: cmp eax,DWORD PTR [edx] 0xf37531a8: mov eax,ecx 0xf37531aa: jne 0xf37531b3 0xf37531ac: add eax,DWORD PTR [edx+0xc] 0xf37531af: mov eax,DWORD PTR [eax] 0xf37531b1: jmp 0xf37531bc 0xf37531b3: xor edx,edx 0xf37531b5: call 0x8184cb0 <__ldl_mmu> 0xf37531ba: mov edx,eax 0xf37531bc: mov edx,DWORD PTR [ebp+0x6ccc] 0xf37531c2: mov DWORD PTR [esp],ebp 0xf37531c5: mov ecx,0xf7d034ac 0xf37531ca: mov DWORD PTR [esp+0x4],ecx 0xf37531ce: xor ecx,ecx 0xf37531d0: mov DWORD PTR [esp+0x8],ecx 0xf37531d4: mov ecx,DWORD PTR [ebp+0x3d4] 0xf37531da: mov DWORD PTR [esp+0xc],ecx 0xf37531de: mov DWORD PTR [esp+0x10],edx 0xf37531e2: mov DWORD PTR [ebp+0x4],eax 0xf37531e5: mov DWORD PTR [ebp+0x3d8],edx On Thu, Aug 23, 2012 at 3:11 AM, 陳韋任 (Wei-Ren Chen) <che...@iis.sinica.edu.tw> wrote: >> subtracting host virtual with a fixed offset for ram. but the thing i >> do not know how to do is how to pass the guest physical back, can i >> store the guest physical in the TCGv from the guest virtual. > > Maybe you can store it on a host unused register, perhaps xmm0? ;) > > Regards, > chenwj > > -- > Wei-Ren Chen (陳韋任) > Computer Systems Lab, Institute of Information Science, > Academia Sinica, Taiwan (R.O.C.) > Tel:886-2-2788-3799 #1667 > Homepage: http://people.cs.nctu.edu.tw/~chenwj