Physical-page instruction-cache synchronization

osfmk/arm/pmap/pmap.c · 15141 lines · browse source

The arm pmap cache-attribute operation calls cache_sync_page for a physical page. Its source comment specifies instruction-cache invalidation and dirty data-cache writeback, the coherency work needed after changing executable bytes.

pmap_attribute_cache_sync source
pmap_attribute_cache_sync(vm_offset_t pa) Invalidates all of the instruction cache on a physical page and pushes any dirty data from the data cache for the same physical page
kern_return_t
pmap_attribute_cache_sync(
	ppnum_t pp,
	vm_size_t size,
	__unused vm_machine_attribute_t attribute,
	__unused vm_machine_attribute_val_t * value)
{
	if (size > PAGE_SIZE) {
		panic("pmap_attribute_cache_sync size: 0x%llx", (uint64_t)size);
	} else {
		cache_sync_page(pp);
	}

	return KERN_SUCCESS;
}