Hello,
i am trying to perform some memory measurements and was hoping you could
point me in the right direction:
My goal is to log every write access to physical memory, the physical
address written as well as the total amount of bytes that are written
(modified) in each access.
My first idea after reading the documentation was to change the
MemoryOps->write ptr to point to a logging function and then pass the
arguments back to the original. However i could'nt reliably locate the
place in the code where these ops get initialized.
I also had a look at exec.c, and tried to hook into 'void
cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, int len,
int is_write)'. This function gets called when starting qemu without any
arguments (and thus no harddiscs or cdrom images), however as soon as i
boot a harddisk the function does not seem to get called anymore.
These are the calls i get when booting an empty system:
0xAdress:written_bytes
-------------------------------
0x07FDD000:590
0x07FDC900:16
0x07FDC88C:4
0x07FDD800:590
0x07FDC910:16
0x07FDC89C:4
0x07FDE000:590
0x07FDC920:16
0x07FDC8AC:4
What would be the 'right' place to place such a hook in your opinion?
Sincerly,
Johannes Stuettgen