On Jul 22, 2014, at 2:27 PM, Alexander Nasonov <[email protected]> wrote:
> Matt Thomas wrote: >> >> On Jul 22, 2014, at 12:54 PM, Alexander Nasonov <[email protected]> wrote: >> >>> Module Name: src >>> Committed By: alnsn >>> Date: Tue Jul 22 19:54:55 UTC 2014 >>> >>> Modified Files: >>> src/sys/arch/mips/include: sljitarch.h >>> >>> Log Message: >>> Define SLJIT_CACHE_FLUSH() for mips. >> >> Actually, this isn't enough. You need to allocate a page of mapped >> memory as RWX and then when you are done use pmap_protect to change >> it to RX followed by pmap_update() and the pmap will automagically >> sync the page for you. > > I allocate with the X flag and it seems to work: > > /* in sljitExecAllocator.c */ > return (void *)uvm_km_alloc(module_map, size, > PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_EXEC); ok. Then you need don't a hook for cache flushing pmap_protect(vm_map_pamp(module_map), va, size) will do that for you. At least for arm/mips/ppc/vax. (e.g. changing a writeable exec page to read-only automatically causes it exec cleaned).
