Dear all, I'm trying to use a signal handler to catch SIGSEGV's in qemu. I want(ed) to use them to track which memory pages are accessed by the guest (only accesses to the pc.ram). After some hours of fruitless mucking around, I've come to the conclusion that it is not as straightforward as with "normal" programs to do that.
I've swapped out the memory allocation part for the pc.ram part. I'm using mmap() to allocate the memory with read/write/exec permissions, and mprotect() with PROT_NONE to revoke all access permissions. I'm also installing a SIGSEGV handler with sigaction(). But this is never called for accesses to the mmap()ed region. This leads me to believe that qemu is doing something behind my back to divert the SIGSEGV signals from my handler. My question is where do I have to touch qemu to call my code for handling SIGSEGVs? Is this possible at all? Can anyone suggest alternative ways of tracking which pages of pc.ram are accessed? Thanks for your help, Thomas.