Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
Linus Torvalds [Sat, 23 Sep 2006 00:50:50 +0000 (17:50 -0700)]
* master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart:
  [AGPGART] Rework AGPv3 modesetting fallback.
  [AGPGART] Add suspend callback for i965
  [AGPGART] Fix number of aperture sizes in 830 gart structs.
  [AGPGART] Intel 965 Express support.
  [AGPGART] agp.h: constify struct agp_bridge_data::version
  [AGPGART] const'ify VIA AGP PCI table.
  [AGPGART] CONFIG_PM=n slim: drivers/char/agp/intel-agp.c
  [AGPGART] CONFIG_PM=n slim: drivers/char/agp/efficeon-agp.c
  [AGPGART] Const'ify the agpgart driver version.
  [AGPGART] remove private page protection map

1  2 
mm/mmap.c

diff --combined mm/mmap.c
+++ b/mm/mmap.c
  #include <asm/cacheflush.h>
  #include <asm/tlb.h>
  
 +#ifndef arch_mmap_check
 +#define arch_mmap_check(addr, len, flags)     (0)
 +#endif
 +
  static void unmap_region(struct mm_struct *mm,
                struct vm_area_struct *vma, struct vm_area_struct *prev,
                unsigned long start, unsigned long end);
@@@ -64,6 -60,13 +64,13 @@@ pgprot_t protection_map[16] = 
        __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
  };
  
+ pgprot_t vm_get_page_prot(unsigned long vm_flags)
+ {
+       return protection_map[vm_flags &
+                               (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
+ }
+ EXPORT_SYMBOL(vm_get_page_prot);
  int sysctl_overcommit_memory = OVERCOMMIT_GUESS;  /* heuristic overcommit */
  int sysctl_overcommit_ratio = 50;     /* default is 50% */
  int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
@@@ -917,10 -920,6 +924,10 @@@ unsigned long do_mmap_pgoff(struct fil
        if (!len)
                return -EINVAL;
  
 +      error = arch_mmap_check(addr, len, flags);
 +      if (error)
 +              return error;
 +
        /* Careful about overflows.. */
        len = PAGE_ALIGN(len);
        if (!len || len > TASK_SIZE)
@@@ -1867,7 -1866,6 +1874,7 @@@ unsigned long do_brk(unsigned long addr
        unsigned long flags;
        struct rb_node ** rb_link, * rb_parent;
        pgoff_t pgoff = addr >> PAGE_SHIFT;
 +      int error;
  
        len = PAGE_ALIGN(len);
        if (!len)
        if ((addr + len) > TASK_SIZE || (addr + len) < addr)
                return -EINVAL;
  
 +      flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 +
 +      error = arch_mmap_check(addr, len, flags);
 +      if (error)
 +              return error;
 +
        /*
         * mlock MCL_FUTURE?
         */
        if (security_vm_enough_memory(len >> PAGE_SHIFT))
                return -ENOMEM;
  
 -      flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 -
        /* Can we just expand an old private anonymous mapping? */
        if (vma_merge(mm, prev, addr, addr + len, flags,
                                        NULL, NULL, pgoff, NULL))