On Tue, Aug 21, 2012 at 9:40 AM, Steven <wangwangk...@gmail.com> wrote: > Hi, Max, > I wrote a small program to verify your patch could catch all the load > instructions from the guest. However, I found some problem from the > results. > > The guest OS and the emulated machine are both 32bit x86. My simple > program in the guest declares an 1048576-element integer array, > initialize the elements, and load them in a loop. It looks like this > int array[1048576]; > initialize the array; > > /* region of interests */ > int temp; > for (i=0; i < 1048576; i++) { > temp = array[i]; > } > So ideally, the path should catch the guest virtual address of in the > loop, right? > In addition, the virtual address for the beginning and end > of the array is 0xbf68b6e0 and 0xbfa8b6e0. > What i got is as follows > > __ldl_mmu, vaddr=bf68b6e0 > __ldl_mmu, vaddr=bf68b6e4 > __ldl_mmu, vaddr=bf68b6e8 > ..... > These should be the virtual address of the above loop. The > results look good because the gap between each vaddr is 4 bypte, which > is the length of each element. > However, after certain address, I got > > __ldl_mmu, vaddr=bf68bffc > __ldl_mmu, vaddr=bf68c000 > __ldl_mmu, vaddr=bf68d000 > __ldl_mmu, vaddr=bf68e000 > __ldl_mmu, vaddr=bf68f000 > __ldl_mmu, vaddr=bf690000 > __ldl_mmu, vaddr=bf691000 > __ldl_mmu, vaddr=bf692000 > __ldl_mmu, vaddr=bf693000 > __ldl_mmu, vaddr=bf694000 > ... > __ldl_mmu, vaddr=bf727000 > __ldl_mmu, vaddr=bf728000 > __ldl_mmu, vaddr=bfa89000 > __ldl_mmu, vaddr=bfa8a000 > So the rest of the vaddr I got has a different of 4096 bytes, instead > of 4. I repeated the experiment for several times and got the same > results. Is there anything wrong? or could you explain this? Thanks.
I see two possibilities here: - maybe there are more fast path shortcuts in the QEMU code? in that case output of qemu -d op,out_asm would help. - maybe your compiler had optimized that sample code? could you try to declare array in your sample as 'volatile int'? -- Thanks. -- Max