On Thu, Jun 28, 2018 at 06:49:27PM +0800, Greentime Hu wrote:
> +void flush_icache_page(struct vm_area_struct *vma, struct page *page)
> +{
> + unsigned long flags;
> + local_irq_save(flags);
> + cpu_cache_wbinval_page((unsigned long)page_address(page),
> + vma->vm_flags & VM_EXEC);
> + local_irq_restore(flags);
> +}
> +EXPORT_SYMBOL(flush_icache_page);
> +
I'm afraid that the page_address(page) will return NULL for non-mapped page.
So I use kmap_atomic/kunmap_atomic here.
ref:
https://github.com/c-sky/csky-linux/blob/master/arch/csky/abiv2/cacheflush.c
> +void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
> + unsigned long addr, int len)
> +{
> + unsigned long _addr = (unsigned long) page_address(page) + (addr &
> ~PAGE_MASK);
> + flush_icache_range(_addr, _addr + len);
> +}
The same as above.
Guo Ren