views:

135

answers:

1

I am writing a JIT on ARM Linux that executes an instruction set that contains self-modifying code. The instruction set does not have any cache flush instructions (similar to x86 in that respect).

If I write out some code to a page and then call mprotect on that page, is that sufficient to invalidate the instruction cache? Or do I also need to use the cacheflush syscall on those pages?

+1  A: 

I believe you do not have to explicitly flush the cache.

Which processor is this? ARMv5? ARMv7?

Yann Ramin
Hmm, I am targeting ARMv5 nominally. According to the ARM ARM, you do need to flush the instruction cache in the case of self-modifying code. I am just wondering if mprotect will do it for me.
Adam Goode