2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1994 - 2003 by Ralf Baechle
8 #include <linux/kernel.h>
9 #include <linux/module.h>
10 #include <linux/sched.h>
13 #include <asm/cacheflush.h>
15 asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
17 /* This should flush more selectivly ... */
23 void flush_dcache_page(struct page *page)
27 if (!cpu_has_dc_aliases)
30 if (page->mapping && page->mapping->i_mmap == NULL &&
31 page->mapping->i_mmap_shared == NULL) {
32 SetPageDcacheDirty(page);
38 * We could delay the flush for the !page->mapping case too. But that
39 * case is for exec env/arg pages and those are 99% certainly going to
40 * get faulted into the tlb (and thus flushed) anyways.
42 addr = (unsigned long) page_address(page);
43 flush_data_cache_page(addr);
46 void __update_cache(struct vm_area_struct *vma, unsigned long address,
52 if (!cpu_has_dc_aliases)
56 if (VALID_PAGE(page) && page->mapping &&
57 (page->flags & (1UL << PG_dcache_dirty))) {
58 if (pages_do_alias((unsigned long) page_address(page), address & PAGE_MASK)) {
59 addr = (unsigned long) page_address(page);
60 flush_data_cache_page(addr);
63 ClearPageDcacheDirty(page);
67 EXPORT_SYMBOL(flush_dcache_page);