From: "David S. Miller" This attempts to take care of 2 of the MM todos I had on my backlog: 1) Zap the stupid flush_cache_all() thing with more meaningful interfaces. 2) Resolve the ptrace user page access issues, first stage. The "first stage" mentioned for #2 is simply creating the user page accesor interfaces. The next stage needs to be mucking with get_user_pages() so that we can control when the flush_dcache_page() occurs. Then we: 1) For every platform where flush_dcache_page() is a non-nop add a call to the beginning of copy_{from,to}_user_page(). 2) Make access_process_vm() set the "no dcache flush" bit in it's call to get_user_pages(). The idea also was that we'd consolidate the write etc. boolean args passed to get_user_pages() into flag bits too. But at least with the below, we can delete that reminder FIXME comment from kernel/ptrace.c, the platforms have the necessary tools and just need to make use of it :) As a bonus I noticed that VMALLOC_VMADDR() did absolutely nothing. After all of this I only have 1 real TODO left, and that's dealing with the SMP TLB/pte invalidation stuff, very low priority until someone starts doing more work with sparc32/SMP in 2.6.x :) # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1384 # [MM]: Kill VMALLOC_VMADDR. # # Nobody defines it to do anything with the address. # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1385 # [MM]: Add flush_cache_kmaps(). # # This is part 1 in a set of changes aimed at killing off # the ambiguous and inefficient flush_cache_all() interface. # # It adds a flush_cache_kmaps() call that, on highmem platforms, # is invoked right before we flush all of the zero pkmaps. # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1386 # [MM]: Add flush_cache_{vmap,vunmap}(). # # This is part 2 in a set of changes aimed at killing off # the ambiguous and inefficient flush_cache_all() interface. # # It adds flush_cache_{vmap,vunmap}() routines that are invoked # when creating and tearing down vmap kernel mappings # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1387 # [MM]: Kill flush_cache_all() from generic code. # # Delete the last reference to flush_cache_all() from generic # files in the kernel, which was in Documentation/cachetlb.txt # -------------------------------------------- # 03/09/01 davem@nuts.ninka.net 1.1388 # [MM]: Add copy_{to,from}_user_page(). # # These interfaces are used when the kernel needs to copy arbitrary # bits in and out of user pages. Currently it is only used by # access_process_vm(). # # These interfaces exist for two reasons: # 1) So that the platform has enough information to flush things # both correctly and efficiently. # 2) So we can kill another one of the hokey cache flushing # interfaces from generic code: flush_user_icache_range(). # -------------------------------------------- # diff -Nru a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt Documentation/cachetlb.txt | 69 ++++++++++++++++++++---------- arch/alpha/kernel/core_irongate.c | 2 arch/alpha/kernel/core_marvel.c | 2 arch/alpha/kernel/core_titan.c | 2 arch/arm/mm/ioremap.c | 2 arch/cris/mm/ioremap.c | 2 arch/i386/mm/ioremap.c | 2 arch/mips/mm/ioremap.c | 2 arch/parisc/mm/ioremap.c | 2 arch/ppc/mm/cachemap.c | 2 arch/ppc/mm/pgtable.c | 2 arch/s390/mm/ioremap.c | 2 arch/sh/mm/ioremap.c | 2 arch/x86_64/mm/ioremap.c | 2 include/asm-alpha/cacheflush.h | 9 +++ include/asm-alpha/pgtable.h | 1 include/asm-arm/arch-adifcc/vmalloc.h | 1 include/asm-arm/arch-anakin/vmalloc.h | 3 - include/asm-arm/arch-cl7500/vmalloc.h | 1 include/asm-arm/arch-clps711x/vmalloc.h | 1 include/asm-arm/arch-ebsa110/vmalloc.h | 1 include/asm-arm/arch-ebsa285/vmalloc.h | 1 include/asm-arm/arch-epxa10db/vmalloc.h | 1 include/asm-arm/arch-integrator/vmalloc.h | 1 include/asm-arm/arch-iop3xx/vmalloc.h | 1 include/asm-arm/arch-l7200/vmalloc.h | 1 include/asm-arm/arch-nexuspci/vmalloc.h | 1 include/asm-arm/arch-pxa/vmalloc.h | 1 include/asm-arm/arch-rpc/vmalloc.h | 1 include/asm-arm/arch-sa1100/vmalloc.h | 1 include/asm-arm/arch-shark/vmalloc.h | 1 include/asm-arm/arch-tbox/vmalloc.h | 1 include/asm-arm/cacheflush.h | 9 +++ include/asm-arm26/cacheflush.h | 7 +++ include/asm-arm26/pgtable.h | 1 include/asm-cris/arch-v10/pgtable.h | 2 include/asm-cris/cacheflush.h | 7 +++ include/asm-h8300/cacheflush.h | 8 +++ include/asm-i386/cacheflush.h | 7 +++ include/asm-i386/highmem.h | 2 include/asm-i386/pgtable.h | 1 include/asm-ia64/cacheflush.h | 9 +++ include/asm-ia64/pgtable.h | 1 include/asm-m68k/cacheflush.h | 7 +++ include/asm-m68k/pgtable.h | 2 include/asm-m68knommu/cacheflush.h | 6 ++ include/asm-mips/cacheflush.h | 8 +++ include/asm-mips/highmem.h | 2 include/asm-mips/pgtable-32.h | 1 include/asm-mips/pgtable-64.h | 1 include/asm-parisc/cacheflush.h | 10 ++++ include/asm-parisc/pgtable.h | 1 include/asm-ppc/cacheflush.h | 9 +++ include/asm-ppc/highmem.h | 2 include/asm-ppc/pgtable.h | 1 include/asm-ppc64/cacheflush.h | 10 ++++ include/asm-ppc64/pgtable.h | 1 include/asm-s390/cacheflush.h | 7 +++ include/asm-s390/pgtable.h | 1 include/asm-sh/cacheflush.h | 10 ++++ include/asm-sh/pgtable.h | 1 include/asm-sparc/cacheflush.h | 8 +++ include/asm-sparc/highmem.h | 2 include/asm-sparc/pgtable.h | 2 include/asm-sparc64/cacheflush.h | 8 +++ include/asm-sparc64/pgtable.h | 1 include/asm-um/pgtable.h | 1 include/asm-v850/cacheflush.h | 8 +++ include/asm-x86_64/cacheflush.h | 7 +++ include/asm-x86_64/pgtable.h | 1 kernel/ptrace.c | 13 +---- mm/highmem.c | 3 - mm/vmalloc.c | 10 ++-- 73 files changed, 233 insertions(+), 88 deletions(-) diff -puN arch/alpha/kernel/core_irongate.c~flush-invalidate-fixes arch/alpha/kernel/core_irongate.c --- 25/arch/alpha/kernel/core_irongate.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/alpha/kernel/core_irongate.c 2003-09-04 01:53:30.000000000 -0700 @@ -391,7 +391,7 @@ irongate_ioremap(unsigned long addr, uns cur_gatt = phys_to_virt(GET_GATT(baddr) & ~1); pte = cur_gatt[GET_GATT_OFF(baddr)] & ~1; - if (__alpha_remap_area_pages(VMALLOC_VMADDR(vaddr), + if (__alpha_remap_area_pages(vaddr, pte, PAGE_SIZE, 0)) { printk("AGP ioremap: FAILED to map...\n"); vfree(area->addr); diff -puN arch/alpha/kernel/core_marvel.c~flush-invalidate-fixes arch/alpha/kernel/core_marvel.c --- 25/arch/alpha/kernel/core_marvel.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/alpha/kernel/core_marvel.c 2003-09-04 01:53:30.000000000 -0700 @@ -696,7 +696,7 @@ marvel_ioremap(unsigned long addr, unsig } pfn >>= 1; /* make it a true pfn */ - if (__alpha_remap_area_pages(VMALLOC_VMADDR(vaddr), + if (__alpha_remap_area_pages(vaddr, pfn << PAGE_SHIFT, PAGE_SIZE, 0)) { printk("FAILED to map...\n"); diff -puN arch/alpha/kernel/core_titan.c~flush-invalidate-fixes arch/alpha/kernel/core_titan.c --- 25/arch/alpha/kernel/core_titan.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/alpha/kernel/core_titan.c 2003-09-04 01:53:30.000000000 -0700 @@ -534,7 +534,7 @@ titan_ioremap(unsigned long addr, unsign } pfn >>= 1; /* make it a true pfn */ - if (__alpha_remap_area_pages(VMALLOC_VMADDR(vaddr), + if (__alpha_remap_area_pages(vaddr, pfn << PAGE_SHIFT, PAGE_SIZE, 0)) { printk("FAILED to map...\n"); diff -puN arch/arm/mm/ioremap.c~flush-invalidate-fixes arch/arm/mm/ioremap.c --- 25/arch/arm/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/arm/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -150,7 +150,7 @@ __ioremap(unsigned long phys_addr, size_ if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } diff -puN arch/cris/mm/ioremap.c~flush-invalidate-fixes arch/cris/mm/ioremap.c --- 25/arch/cris/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/cris/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -157,7 +157,7 @@ void * __ioremap(unsigned long phys_addr if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } diff -puN arch/i386/mm/ioremap.c~flush-invalidate-fixes arch/i386/mm/ioremap.c --- 25/arch/i386/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/i386/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -158,7 +158,7 @@ void * __ioremap(unsigned long phys_addr return NULL; area->phys_addr = phys_addr; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vunmap(addr); return NULL; } diff -puN arch/mips/mm/ioremap.c~flush-invalidate-fixes arch/mips/mm/ioremap.c --- 25/arch/mips/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/mips/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -162,7 +162,7 @@ void * __ioremap(phys_t phys_addr, phys_ if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vunmap(addr); return NULL; } diff -puN arch/parisc/mm/ioremap.c~flush-invalidate-fixes arch/parisc/mm/ioremap.c --- 25/arch/parisc/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/parisc/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -159,7 +159,7 @@ void * __ioremap(unsigned long phys_addr if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } diff -puN arch/ppc/mm/cachemap.c~flush-invalidate-fixes arch/ppc/mm/cachemap.c --- 25/arch/ppc/mm/cachemap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/ppc/mm/cachemap.c 2003-09-04 01:53:30.000000000 -0700 @@ -101,7 +101,7 @@ void *consistent_alloc(int gfp, size_t s if (! area) goto out; - va = VMALLOC_VMADDR(area->addr); + va = (unsigned long) area->addr; flags = _PAGE_KERNEL | _PAGE_NO_CACHE; diff -puN arch/ppc/mm/pgtable.c~flush-invalidate-fixes arch/ppc/mm/pgtable.c --- 25/arch/ppc/mm/pgtable.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/ppc/mm/pgtable.c 2003-09-04 01:53:30.000000000 -0700 @@ -195,7 +195,7 @@ __ioremap(phys_addr_t addr, unsigned lon area = get_vm_area(size, VM_IOREMAP); if (area == 0) return NULL; - v = VMALLOC_VMADDR(area->addr); + v = (unsigned long) area->addr; } else { v = (ioremap_bot -= size); } diff -puN arch/s390/mm/ioremap.c~flush-invalidate-fixes arch/s390/mm/ioremap.c --- 25/arch/s390/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/s390/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -124,7 +124,7 @@ void * __ioremap(unsigned long phys_addr if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } diff -puN arch/sh/mm/ioremap.c~flush-invalidate-fixes arch/sh/mm/ioremap.c --- 25/arch/sh/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/sh/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -149,7 +149,7 @@ void * p3_ioremap(unsigned long phys_add if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vfree(addr); return NULL; } diff -puN arch/x86_64/mm/ioremap.c~flush-invalidate-fixes arch/x86_64/mm/ioremap.c --- 25/arch/x86_64/mm/ioremap.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/arch/x86_64/mm/ioremap.c 2003-09-04 01:53:30.000000000 -0700 @@ -159,7 +159,7 @@ void * __ioremap(unsigned long phys_addr if (!area) return NULL; addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { + if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { vunmap(addr); return NULL; } diff -puN Documentation/cachetlb.txt~flush-invalidate-fixes Documentation/cachetlb.txt --- 25/Documentation/cachetlb.txt~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/Documentation/cachetlb.txt 2003-09-04 01:53:30.000000000 -0700 @@ -165,15 +165,7 @@ and have no dependency on translation in Here are the routines, one by one: -1) void flush_cache_all(void) - - The most severe flush of all. After this interface runs, - the entire cpu cache is flushed. - - This is usually invoked when the kernel page tables are - changed, since such translations are "global" in nature. - -2) void flush_cache_mm(struct mm_struct *mm) +1) void flush_cache_mm(struct mm_struct *mm) This interface flushes an entire user address space from the caches. That is, after running, there will be no cache @@ -183,7 +175,7 @@ Here are the routines, one by one: page table operations such as what happens during fork, exit, and exec. -3) void flush_cache_range(struct vm_area_struct *vma, +2) void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) Here we are flushing a specific range of (user) virtual @@ -200,7 +192,7 @@ Here are the routines, one by one: call flush_cache_page (see below) for each entry which may be modified. -4) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr) +3) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr) This time we need to remove a PAGE_SIZE sized range from the cache. The 'vma' is the backing structure used by @@ -215,6 +207,30 @@ Here are the routines, one by one: This is used primarily during fault processing. +4) void flush_cache_kmaps(void) + + This routine need only be implemented if the platform utilizes + highmem. It will be called right before all of the kmaps + are invalidated. + + After running, there will be no entries in the cache for + the kernel virtual address range PKMAP_ADDR(0) to + PKMAP_ADDR(LAST_PKMAP). + + This routing should be implemented in asm/highmem.h + +5) void flush_cache_vmap(unsigned long start, unsigned long end) + void flush_cache_vunmap(unsigned long start, unsigned long end) + + Here in these two interfaces we are flushing a specific range + of (kernel) virtual addresses from the cache. After running, + there will be no entries in the cache for the kernel address + space for virtual addresses in the range 'start' to 'end'. + + The first of these two routines is invoked after map_vm_area() + has installed the page table entries. The second is invoked + before unmap_vm_area() deletes the page table entries. + There exists another whole class of cpu cache issues which currently require a whole different set of interfaces to handle properly. The biggest problem is that of virtual aliasing in the data cache @@ -317,6 +333,26 @@ maps this page at its virtual address. dirty. Again, see sparc64 for examples of how to deal with this. + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, + unsigned long user_vaddr, + void *dst, void *src, int len) + void copy_from_user_page(struct vm_area_struct *vma, struct page *page, + unsigned long user_vaddr, + void *dst, void *src, int len) + When the kernel needs to copy arbitrary data in and out + of arbitrary user pages (f.e. for ptrace()) it will use + these two routines. + + The page has been kmap()'d, and flush_cache_page() has + just been called for the user mapping of this page (if + necessary). + + Any necessary cache flushing or other coherency operations + that need to occur should happen here. If the processor's + instruction cache does not snoop cpu stores, it is very + likely that you will need to flush the instruction cache + for copy_to_user_page(). + void flush_icache_range(unsigned long start, unsigned long end) When the kernel stores into addresses that it will execute out of (eg when loading modules), this function is called. @@ -324,17 +360,6 @@ maps this page at its virtual address. If the icache does not snoop stores then this routine will need to flush it. - void flush_icache_user_range(struct vm_area_struct *vma, - struct page *page, unsigned long addr, int len) - This is called when the kernel stores into addresses that are - part of the address space of a user process (which may be some - other process than the current process). The addr argument - gives the virtual address in that process's address space, - page is the page which is being modified, and len indicates - how many bytes have been modified. The modified region must - not cross a page boundary. Currently this is only called from - kernel/ptrace.c. - void flush_icache_page(struct vm_area_struct *vma, struct page *page) All the functionality of flush_icache_page can be implemented in flush_dcache_page and update_mmu_cache. In 2.7 the hope is to diff -puN include/asm-alpha/cacheflush.h~flush-invalidate-fixes include/asm-alpha/cacheflush.h --- 25/include/asm-alpha/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-alpha/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -10,6 +10,8 @@ #define flush_cache_range(vma, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_dcache_page(page) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) /* Note that the following two definitions are _highly_ dependent on the contexts in which they are used in the kernel. I personally @@ -60,4 +62,11 @@ extern void flush_icache_user_range(stru #define flush_icache_page(vma, page) \ flush_icache_user_range((vma), (page), 0, 0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + #endif /* _ALPHA_CACHEFLUSH_H */ diff -puN include/asm-alpha/pgtable.h~flush-invalidate-fixes include/asm-alpha/pgtable.h --- 25/include/asm-alpha/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-alpha/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -49,7 +49,6 @@ #else #define VMALLOC_START (-2*PGDIR_SIZE) #endif -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (-PGDIR_SIZE) /* diff -puN include/asm-arm26/cacheflush.h~flush-invalidate-fixes include/asm-arm26/cacheflush.h --- 25/include/asm-arm26/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm26/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -25,6 +25,8 @@ #define flush_cache_range(vma,start,end) do { } while (0) #define flush_cache_page(vma,vmaddr) do { } while (0) #define flush_page_to_ram(page) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) #define invalidate_dcache_range(start,end) do { } while (0) #define clean_dcache_range(start,end) do { } while (0) @@ -37,6 +39,11 @@ #define flush_icache_range(start,end) do { } while (0) #define flush_icache_page(vma,page) do { } while (0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + /* DAG: ARM3 will flush cache on MEMC updates anyway? so don't bother */ /* IM : Yes, it will, but only if setup to do so (we do this). */ #define clean_cache_area(_start,_size) do { } while (0) diff -puN include/asm-arm26/pgtable.h~flush-invalidate-fixes include/asm-arm26/pgtable.h --- 25/include/asm-arm26/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm26/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -173,7 +173,6 @@ extern struct page *empty_zero_page; * area for the same reason. ;) FIXME: surely 1 page not 4k ? */ #define VMALLOC_START 0x01a00000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END 0x01c00000 /* Is pmd_page supposed to return a pointer to a page in some arches? ours seems to diff -puN include/asm-arm/arch-adifcc/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-adifcc/vmalloc.h --- 25/include/asm-arm/arch-adifcc/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-adifcc/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xe8000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-anakin/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-anakin/vmalloc.h --- 25/include/asm-arm/arch-anakin/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-anakin/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -19,8 +19,7 @@ * linux/arch/arm/kernel/traps.c) */ #define VMALLOC_ARCH_OFFSET (8 * 1024 * 1024) -#define VMALLOC_VMADDR(a) ((unsigned int) (a)) -#define VMALLOC_START ((VMALLOC_VMADDR(high_memory) + VMALLOC_ARCH_OFFSET) & ~(VMALLOC_ARCH_OFFSET - 1)) +#define VMALLOC_START (((unsigned long) (high_memory) + VMALLOC_ARCH_OFFSET) & ~(VMALLOC_ARCH_OFFSET - 1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-cl7500/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-cl7500/vmalloc.h --- 25/include/asm-arm/arch-cl7500/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-cl7500/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x1c000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-clps711x/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-clps711x/vmalloc.h --- 25/include/asm-arm/arch-clps711x/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-clps711x/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -28,7 +28,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-ebsa110/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-ebsa110/vmalloc.h --- 25/include/asm-arm/arch-ebsa110/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-ebsa110/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -18,7 +18,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x1f000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-ebsa285/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-ebsa285/vmalloc.h --- 25/include/asm-arm/arch-ebsa285/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-ebsa285/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -18,7 +18,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #ifdef CONFIG_ARCH_FOOTBRIDGE #define VMALLOC_END (PAGE_OFFSET + 0x30000000) diff -puN include/asm-arm/arch-epxa10db/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-epxa10db/vmalloc.h --- 25/include/asm-arm/arch-epxa10db/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-epxa10db/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -28,7 +28,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-integrator/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-integrator/vmalloc.h --- 25/include/asm-arm/arch-integrator/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-integrator/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -28,7 +28,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-iop3xx/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-iop3xx/vmalloc.h --- 25/include/asm-arm/arch-iop3xx/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-iop3xx/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xe8000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-l7200/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-l7200/vmalloc.h --- 25/include/asm-arm/arch-l7200/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-l7200/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-nexuspci/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-nexuspci/vmalloc.h --- 25/include/asm-arm/arch-nexuspci/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-nexuspci/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x20000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-pxa/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-pxa/vmalloc.h --- 25/include/asm-arm/arch-pxa/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-pxa/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -19,7 +19,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xe8000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-rpc/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-rpc/vmalloc.h --- 25/include/asm-arm/arch-rpc/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-rpc/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -18,7 +18,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x1c000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-sa1100/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-sa1100/vmalloc.h --- 25/include/asm-arm/arch-sa1100/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-sa1100/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xe8000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-shark/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-shark/vmalloc.h --- 25/include/asm-arm/arch-shark/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-shark/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/arch-tbox/vmalloc.h~flush-invalidate-fixes include/asm-arm/arch-tbox/vmalloc.h --- 25/include/asm-arm/arch-tbox/vmalloc.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/arch-tbox/vmalloc.h 2003-09-04 01:53:30.000000000 -0700 @@ -12,7 +12,6 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #define MODULE_START (PAGE_OFFSET - 16*1048576) diff -puN include/asm-arm/cacheflush.h~flush-invalidate-fixes include/asm-arm/cacheflush.h --- 25/include/asm-arm/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-arm/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -206,6 +206,15 @@ extern void dmac_inv_range(unsigned long extern void dmac_clean_range(unsigned long, unsigned long); extern void dmac_flush_range(unsigned long, unsigned long); +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + #endif /* diff -puN include/asm-cris/arch-v10/pgtable.h~flush-invalidate-fixes include/asm-cris/arch-v10/pgtable.h --- 25/include/asm-cris/arch-v10/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-cris/arch-v10/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -7,11 +7,9 @@ #ifdef CONFIG_CRIS_LOW_MAP #define VMALLOC_START KSEG_7 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END KSEG_8 #else #define VMALLOC_START KSEG_D -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END KSEG_E #endif diff -puN include/asm-cris/cacheflush.h~flush-invalidate-fixes include/asm-cris/cacheflush.h --- 25/include/asm-cris/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-cris/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -16,6 +16,13 @@ #define flush_icache_range(start, end) do { } while (0) #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) void global_flush_tlb(void); int change_page_attr(struct page *page, int numpages, pgprot_t prot); diff -puN include/asm-h8300/cacheflush.h~flush-invalidate-fixes include/asm-h8300/cacheflush.h --- 25/include/asm-h8300/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-h8300/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -11,7 +11,6 @@ */ #define flush_cache_all() -#define flush_cache_all() #define flush_cache_mm(mm) #define flush_cache_range(vma,a,b) #define flush_cache_page(vma,p) @@ -20,6 +19,8 @@ #define flush_icache() #define flush_icache_page(vma,page) #define flush_icache_range(start,len) +#define flush_cache_vmap(start, end) +#define flush_cache_vunmap(start, end) #define cache_push_v(vaddr,len) #define cache_push(paddr,len) #define cache_clear(paddr,len) @@ -28,4 +29,9 @@ #define flush_icache_user_range(vma,page,addr,len) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + #endif /* _ASM_H8300_CACHEFLUSH_H */ diff -puN include/asm-i386/cacheflush.h~flush-invalidate-fixes include/asm-i386/cacheflush.h --- 25/include/asm-i386/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-i386/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -13,6 +13,13 @@ #define flush_icache_range(start, end) do { } while (0) #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) void global_flush_tlb(void); int change_page_attr(struct page *page, int numpages, pgprot_t prot); diff -puN include/asm-i386/highmem.h~flush-invalidate-fixes include/asm-i386/highmem.h --- 25/include/asm-i386/highmem.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-i386/highmem.h 2003-09-04 01:53:30.000000000 -0700 @@ -63,6 +63,8 @@ void *kmap_atomic(struct page *page, enu void kunmap_atomic(void *kvaddr, enum km_type type); struct page *kmap_atomic_to_page(void *ptr); +#define flush_cache_kmaps() do { } while (0) + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff -puN include/asm-i386/pgtable.h~flush-invalidate-fixes include/asm-i386/pgtable.h --- 25/include/asm-i386/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-i386/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -85,7 +85,6 @@ void paging_init(void); #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long) high_memory + 2*VMALLOC_OFFSET-1) & \ ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #ifdef CONFIG_HIGHMEM # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) #else diff -puN include/asm-ia64/cacheflush.h~flush-invalidate-fixes include/asm-ia64/cacheflush.h --- 25/include/asm-ia64/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ia64/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -21,6 +21,8 @@ #define flush_cache_range(vma, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_icache_page(vma,page) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) #define flush_dcache_page(page) \ do { \ @@ -35,4 +37,11 @@ do { \ flush_icache_range(_addr, _addr + (len)); \ } while (0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + #endif /* _ASM_IA64_CACHEFLUSH_H */ diff -puN include/asm-ia64/pgtable.h~flush-invalidate-fixes include/asm-ia64/pgtable.h --- 25/include/asm-ia64/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ia64/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -207,7 +207,6 @@ ia64_phys_addr_valid (unsigned long addr #define RGN_KERNEL 7 #define VMALLOC_START 0xa000000200000000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #ifdef CONFIG_VIRTUAL_MEM_MAP # define VMALLOC_END_INIT (0xa000000000000000 + (1UL << (4*PAGE_SHIFT - 9))) # define VMALLOC_END vmalloc_end diff -puN include/asm-m68k/cacheflush.h~flush-invalidate-fixes include/asm-m68k/cacheflush.h --- 25/include/asm-m68k/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-m68k/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -80,6 +80,9 @@ extern void cache_push_v(unsigned long v #define flush_cache_all() __flush_cache_all() +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() + extern inline void flush_cache_mm(struct mm_struct *mm) { if (mm == current->mm) @@ -127,6 +130,10 @@ extern inline void __flush_page_to_ram(v #define flush_dcache_page(page) __flush_page_to_ram(page_address(page)) #define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page)) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) extern void flush_icache_range(unsigned long address, unsigned long endaddr); diff -puN include/asm-m68knommu/cacheflush.h~flush-invalidate-fixes include/asm-m68knommu/cacheflush.h --- 25/include/asm-m68knommu/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-m68knommu/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -15,7 +15,13 @@ #define flush_icache_range(start,len) __flush_cache_all() #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) extern inline void __flush_cache_all(void) { diff -puN include/asm-m68k/pgtable.h~flush-invalidate-fixes include/asm-m68k/pgtable.h --- 25/include/asm-m68k/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-m68k/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -79,12 +79,10 @@ */ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END KMAP_START #else extern unsigned long vmalloc_end; #define VMALLOC_START 0x0f800000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END vmalloc_end #endif /* CONFIG_SUN3 */ diff -puN include/asm-mips/cacheflush.h~flush-invalidate-fixes include/asm-mips/cacheflush.h --- 25/include/asm-mips/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-mips/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -43,7 +43,15 @@ extern void (*flush_icache_page)(struct extern void (*flush_icache_range)(unsigned long start, unsigned long end); #define flush_icache_user_range(vma, page, addr, len) \ flush_icache_page(vma, page) +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) extern void (*flush_cache_sigtramp)(unsigned long addr); extern void (*flush_icache_all)(void); diff -puN include/asm-mips/highmem.h~flush-invalidate-fixes include/asm-mips/highmem.h --- 25/include/asm-mips/highmem.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-mips/highmem.h 2003-09-04 01:53:30.000000000 -0700 @@ -54,6 +54,8 @@ extern void *kmap_atomic(struct page *pa extern void kunmap_atomic(void *kvaddr, enum km_type type); extern struct page *kmap_atomic_to_page(void *ptr); +#define flush_cache_kmaps() flush_cache_all() + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff -puN include/asm-mips/pgtable-32.h~flush-invalidate-fixes include/asm-mips/pgtable-32.h --- 25/include/asm-mips/pgtable-32.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-mips/pgtable-32.h 2003-09-04 01:53:30.000000000 -0700 @@ -79,7 +79,6 @@ extern int add_temporary_entry(unsigned #define FIRST_USER_PGD_NR 0 #define VMALLOC_START KSEG2 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #if CONFIG_HIGHMEM # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) diff -puN include/asm-mips/pgtable-64.h~flush-invalidate-fixes include/asm-mips/pgtable-64.h --- 25/include/asm-mips/pgtable-64.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-mips/pgtable-64.h 2003-09-04 01:53:30.000000000 -0700 @@ -64,7 +64,6 @@ #define FIRST_USER_PGD_NR 0 #define VMALLOC_START XKSEG -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END \ (VMALLOC_START + ((1 << PGD_ORDER) * PTRS_PER_PTE * PAGE_SIZE)) diff -puN include/asm-parisc/cacheflush.h~flush-invalidate-fixes include/asm-parisc/cacheflush.h --- 25/include/asm-parisc/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-parisc/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -30,6 +30,9 @@ static inline void flush_cache_all(void) on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1); } +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() + /* The following value needs to be tuned and probably scaled with the * cache size. */ @@ -81,6 +84,13 @@ static inline void flush_dcache_page(str #define flush_icache_user_range(vma, page, addr, len) \ flush_icache_page((vma), (page)) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + static inline void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { diff -puN include/asm-parisc/pgtable.h~flush-invalidate-fixes include/asm-parisc/pgtable.h --- 25/include/asm-parisc/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-parisc/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -108,7 +108,6 @@ extern void *vmalloc_start; #define PCXL_DMA_MAP_SIZE (8*1024*1024) #define VMALLOC_START ((unsigned long)vmalloc_start) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) /* this is a fixmap remnant, see fixmap.h */ #define VMALLOC_END (TMPALIAS_MAP_START) #endif diff -puN include/asm-ppc64/cacheflush.h~flush-invalidate-fixes include/asm-ppc64/cacheflush.h --- 25/include/asm-ppc64/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ppc64/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -14,12 +14,22 @@ #define flush_cache_range(vma, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_icache_page(vma, page) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) extern void flush_dcache_page(struct page *page); extern void flush_icache_range(unsigned long, unsigned long); extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, unsigned long addr, int len); + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + extern void __flush_dcache_icache(void *page_va); #endif /* _PPC64_CACHEFLUSH_H */ diff -puN include/asm-ppc64/pgtable.h~flush-invalidate-fixes include/asm-ppc64/pgtable.h --- 25/include/asm-ppc64/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ppc64/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -45,7 +45,6 @@ * Define the address range of the vmalloc VM area. */ #define VMALLOC_START (0xD000000000000000) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (VMALLOC_START + VALID_EA_BITS) /* diff -puN include/asm-ppc/cacheflush.h~flush-invalidate-fixes include/asm-ppc/cacheflush.h --- 25/include/asm-ppc/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ppc/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -24,12 +24,21 @@ #define flush_cache_range(vma, a, b) do { } while (0) #define flush_cache_page(vma, p) do { } while (0) #define flush_icache_page(vma, page) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) extern void flush_dcache_page(struct page *page); extern void flush_icache_range(unsigned long, unsigned long); extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, unsigned long addr, int len); +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + extern void __flush_dcache_icache(void *page_va); extern void __flush_dcache_icache_phys(unsigned long physaddr); diff -puN include/asm-ppc/highmem.h~flush-invalidate-fixes include/asm-ppc/highmem.h --- 25/include/asm-ppc/highmem.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ppc/highmem.h 2003-09-04 01:53:30.000000000 -0700 @@ -131,6 +131,8 @@ static inline struct page *kmap_atomic_t return pte_page(kmap_pte[idx]); } +#define flush_cache_kmaps() flush_cache_all() + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff -puN include/asm-ppc/pgtable.h~flush-invalidate-fixes include/asm-ppc/pgtable.h --- 25/include/asm-ppc/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-ppc/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -129,7 +129,6 @@ extern unsigned long ioremap_bot, iorema #else #define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) #endif -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END ioremap_bot /* diff -puN include/asm-s390/cacheflush.h~flush-invalidate-fixes include/asm-s390/cacheflush.h --- 25/include/asm-s390/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-s390/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -13,5 +13,12 @@ #define flush_icache_range(start, end) do { } while (0) #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) #endif /* _S390_CACHEFLUSH_H */ diff -puN include/asm-s390/pgtable.h~flush-invalidate-fixes include/asm-s390/pgtable.h --- 25/include/asm-s390/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-s390/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -117,7 +117,6 @@ extern char empty_zero_page[PAGE_SIZE]; #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) \ & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #ifndef __s390x__ # define VMALLOC_END (0x7fffffffL) #else /* __s390x__ */ diff -puN include/asm-sh/cacheflush.h~flush-invalidate-fixes include/asm-sh/cacheflush.h --- 25/include/asm-sh/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sh/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -10,4 +10,14 @@ extern void __flush_purge_region(void *s /* Flush (invalidate only) a region (smaller than a page) */ extern void __flush_invalidate_region(void *start, int size); +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + #endif /* __ASM_SH_CACHEFLUSH_H */ diff -puN include/asm-sh/pgtable.h~flush-invalidate-fixes include/asm-sh/pgtable.h --- 25/include/asm-sh/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sh/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -51,7 +51,6 @@ extern unsigned long empty_zero_page[102 * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c) */ #define VMALLOC_START (P3SEG+0x00100000) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END P4SEG /* 0x001 WT-bit on SH-4, 0 on SH-3 */ diff -puN include/asm-sparc64/cacheflush.h~flush-invalidate-fixes include/asm-sparc64/cacheflush.h --- 25/include/asm-sparc64/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sparc64/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -48,6 +48,14 @@ extern void smp_flush_cache_all(void); #define flush_icache_page(vma, pg) do { } while(0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + extern void flush_dcache_page(struct page *page); +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() + #endif /* _SPARC64_CACHEFLUSH_H */ diff -puN include/asm-sparc64/pgtable.h~flush-invalidate-fixes include/asm-sparc64/pgtable.h --- 25/include/asm-sparc64/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sparc64/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -30,7 +30,6 @@ #define MODULES_LEN 0x000000007e000000 #define MODULES_END 0x0000000080000000 #define VMALLOC_START 0x0000000140000000 -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END 0x0000000200000000 #define LOW_OBP_ADDRESS 0x00000000f0000000 #define HI_OBP_ADDRESS 0x0000000100000000 diff -puN include/asm-sparc/cacheflush.h~flush-invalidate-fixes include/asm-sparc/cacheflush.h --- 25/include/asm-sparc/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sparc/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -56,6 +56,11 @@ BTFIXUPDEF_CALL(void, flush_cache_page, #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) @@ -66,4 +71,7 @@ extern void sparc_flush_page_to_ram(stru #define flush_dcache_page(page) sparc_flush_page_to_ram(page) +#define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vunmap(start, end) flush_cache_all() + #endif /* _SPARC_CACHEFLUSH_H */ diff -puN include/asm-sparc/highmem.h~flush-invalidate-fixes include/asm-sparc/highmem.h --- 25/include/asm-sparc/highmem.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sparc/highmem.h 2003-09-04 01:53:30.000000000 -0700 @@ -89,6 +89,8 @@ static inline struct page *kmap_atomic_t return pte_page(*pte); } +#define flush_cache_kmaps() flush_cache_all() + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff -puN include/asm-sparc/pgtable.h~flush-invalidate-fixes include/asm-sparc/pgtable.h --- 25/include/asm-sparc/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-sparc/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -101,8 +101,6 @@ BTFIXUPDEF_SIMM13(ptrs_per_pmd) BTFIXUPDEF_SIMM13(ptrs_per_pgd) BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) - #define pte_ERROR(e) __builtin_trap() #define pmd_ERROR(e) __builtin_trap() #define pgd_ERROR(e) __builtin_trap() diff -puN include/asm-um/pgtable.h~flush-invalidate-fixes include/asm-um/pgtable.h --- 25/include/asm-um/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-um/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -69,7 +69,6 @@ extern unsigned long high_physmem; #define VMALLOC_OFFSET (__va_space) #define VMALLOC_START (((unsigned long) high_physmem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #ifdef CONFIG_HIGHMEM # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) diff -puN include/asm-v850/cacheflush.h~flush-invalidate-fixes include/asm-v850/cacheflush.h --- 25/include/asm-v850/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-v850/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -27,6 +27,8 @@ #define flush_cache_range(vma, start, end) ((void)0) #define flush_cache_page(vma, vmaddr) ((void)0) #define flush_dcache_page(page) ((void)0) +#define flush_cache_vmap(start, end) ((void)0) +#define flush_cache_vunmap(start, end) ((void)0) #ifdef CONFIG_NO_CACHE @@ -55,5 +57,11 @@ extern void flush_cache_sigtramp (unsign #endif /* CONFIG_NO_CACHE */ +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ +do { memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ +} while (0) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) #endif /* __V850_CACHEFLUSH_H__ */ diff -puN include/asm-x86_64/cacheflush.h~flush-invalidate-fixes include/asm-x86_64/cacheflush.h --- 25/include/asm-x86_64/cacheflush.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-x86_64/cacheflush.h 2003-09-04 01:53:30.000000000 -0700 @@ -13,6 +13,13 @@ #define flush_icache_range(start, end) do { } while (0) #define flush_icache_page(vma,pg) do { } while (0) #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) void global_flush_tlb(void); int change_page_attr(struct page *page, int numpages, pgprot_t prot); diff -puN include/asm-x86_64/pgtable.h~flush-invalidate-fixes include/asm-x86_64/pgtable.h --- 25/include/asm-x86_64/pgtable.h~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/include/asm-x86_64/pgtable.h 2003-09-04 01:53:30.000000000 -0700 @@ -126,7 +126,6 @@ static inline void set_pml4(pml4_t *dst, #ifndef __ASSEMBLY__ #define VMALLOC_START 0xffffff0000000000 #define VMALLOC_END 0xffffff7fffffffff -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define MODULES_VADDR 0xffffffffa0000000 #define MODULES_END 0xffffffffafffffff #define MODULES_LEN (MODULES_END - MODULES_VADDR) diff -puN kernel/ptrace.c~flush-invalidate-fixes kernel/ptrace.c --- 25/kernel/ptrace.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/kernel/ptrace.c 2003-09-04 01:53:30.000000000 -0700 @@ -179,19 +179,14 @@ int access_process_vm(struct task_struct flush_cache_page(vma, addr); - /* - * FIXME! We used to have flush_page_to_ram() in here, but - * that was wrong. davem says we need a new per-arch primitive - * to handle this correctly. - */ - maddr = kmap(page); if (write) { - memcpy(maddr + offset, buf, bytes); - flush_icache_user_range(vma, page, addr, bytes); + copy_to_user_page(vma, addr, page, + maddr + offset, buf, bytes); set_page_dirty_lock(page); } else { - memcpy(buf, maddr + offset, bytes); + copy_from_user_page(vma, addr, page, + buf, maddr + offset, bytes); } kunmap(page); page_cache_release(page); diff -puN mm/highmem.c~flush-invalidate-fixes mm/highmem.c --- 25/mm/highmem.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/mm/highmem.c 2003-09-04 01:53:30.000000000 -0700 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -62,7 +63,7 @@ static void flush_all_zero_pkmaps(void) { int i; - flush_cache_all(); + flush_cache_kmaps(); for (i = 0; i < LAST_PKMAP; i++) { struct page *page; diff -puN mm/vmalloc.c~flush-invalidate-fixes mm/vmalloc.c --- 25/mm/vmalloc.c~flush-invalidate-fixes 2003-09-04 01:53:30.000000000 -0700 +++ 25-akpm/mm/vmalloc.c 2003-09-04 01:53:30.000000000 -0700 @@ -135,23 +135,23 @@ static int map_area_pmd(pmd_t *pmd, unsi void unmap_vm_area(struct vm_struct *area) { - unsigned long address = VMALLOC_VMADDR(area->addr); + unsigned long address = (unsigned long) area->addr; unsigned long end = (address + area->size); pgd_t *dir; dir = pgd_offset_k(address); - flush_cache_all(); + flush_cache_vunmap(address, end); do { unmap_area_pmd(dir, address, end - address); address = (address + PGDIR_SIZE) & PGDIR_MASK; dir++; } while (address && (address < end)); - flush_tlb_kernel_range(VMALLOC_VMADDR(area->addr), end); + flush_tlb_kernel_range((unsigned long) area->addr, end); } int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) { - unsigned long address = VMALLOC_VMADDR(area->addr); + unsigned long address = (unsigned long) area->addr; unsigned long end = address + (area->size-PAGE_SIZE); pgd_t *dir; int err = 0; @@ -174,7 +174,7 @@ int map_vm_area(struct vm_struct *area, } while (address && (address < end)); spin_unlock(&init_mm.page_table_lock); - flush_cache_all(); + flush_cache_vmap((unsigned long) area->addr, end); return err; } _