My goal is to instrument the region-of-interest of a program in syscall emulation mode. I have already implemented pseudo instructions for full system mode based on this tutorial. It is time consuming though to test everything in FS after I make even a small change. Is there any way to implement the same functionality for syscall mode?
So I found what the problem was. You need to remove all mentions of mmap. So in my case it would be removing the include of m5_mmap.h in the microbenchmark and not calling map_m5_mem() first thing in main(). Just call m5_roi_begin() and m5_roi_end() (or however you call your instrumentation functions).
Also in the gem5 x86 makefile (gem5/util/m5/Makefile.x86) remove the
-DM5OP_ADDR=0xFFFF0000
flag and compile again (make -f Makefile.x86). Now when I run the microbenchmark with gem5, I can see when the ROI starts and ends. Everyting else remains the same, as I've posted in a comment above to the question.
Thanks Ciro.