]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - arch/sparc/kernel/sys_sparc_32.c
mm: use vm_unmapped_area() on sparc32 architecture
[~shefty/rdma-dev.git] / arch / sparc / kernel / sys_sparc_32.c
index 0c9b31b22e07e3e68b1f43f3928f0483dd9a7960..57277c8301518db33d49dfb5cd326d49212a62da 100644 (file)
@@ -34,11 +34,9 @@ asmlinkage unsigned long sys_getpagesize(void)
        return PAGE_SIZE; /* Possibly older binaries want 8192 on sun4's? */
 }
 
-#define COLOUR_ALIGN(addr)      (((addr)+SHMLBA-1)&~(SHMLBA-1))
-
 unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
 {
-       struct vm_area_struct * vmm;
+       struct vm_unmapped_area_info info;
 
        if (flags & MAP_FIXED) {
                /* We do not accept a shared mapping if it would violate
@@ -56,21 +54,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
        if (!addr)
                addr = TASK_UNMAPPED_BASE;
 
-       if (flags & MAP_SHARED)
-               addr = COLOUR_ALIGN(addr);
-       else
-               addr = PAGE_ALIGN(addr);
-
-       for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
-               /* At this point:  (!vmm || addr < vmm->vm_end). */
-               if (TASK_SIZE - PAGE_SIZE - len < addr)
-                       return -ENOMEM;
-               if (!vmm || addr + len <= vmm->vm_start)
-                       return addr;
-               addr = vmm->vm_end;
-               if (flags & MAP_SHARED)
-                       addr = COLOUR_ALIGN(addr);
-       }
+       info.flags = 0;
+       info.length = len;
+       info.low_limit = addr;
+       info.high_limit = TASK_SIZE;
+       info.align_mask = (flags & MAP_SHARED) ?
+               (PAGE_MASK & (SHMLBA - 1)) : 0;
+       info.align_offset = pgoff << PAGE_SHIFT;
+       return vm_unmapped_area(&info);
 }
 
 /*