Thank you for the reply Martin, I'll defitively give it a shot.
Surfing the web I've also find this nice api on windows:
https://docs.microsoft.com/en-us/...oryapi/nf-memoryapi-getwritewatch
It would seems that it allows me to query the dirty pages from a memory region, and at that point is easy for me to copy all the modified pages to the "mirror" region, pretty simple.
Unfortunately linux hasn't anything like this, but I was thinking that I could keep my "own" dirty bits and set them on SIGSEGV signals...
It should work and should be simple enough to implement, but definitively I'll also try your "direct" solution :)
Thank you very much.
Leonardo