help, trying to invalidate entire icache on 970

Paul Mackerras paulus at
Wed Apr 6 10:28:09 EST 2005

Chris Friesen writes:

> My problem is that I have an application (emulator) that modifies its 
> own instructions but doesn't track the addresses.  Thus I need to flush 
> the entire dcache (on the 970 this is just a "sync"), and invalidate the 
> entire icache.

Current BK now has support for making pages non-executable with
mprotect.  You could mprotect the pages RW to start with and have a
SIGSEGV handler.  When the emulator tries to execute from a page you
will get a SIGSEGV, and you can flush that page (with 32 x dcbst;
sync; 32 x icbi; isync) and then mprotect it RX and return from the
signal handler.  If the emulator writes to it you get another SIGSEGV
and mprotect it back to RW.


More information about the Linuxppc64-dev mailing list