6 #include <linux/mman.h>
8 #include <linux/sched.h>
10 #include <linux/personality.h>
11 #include <linux/random.h>
12 #include <asm/cachetype.h>
14 static inline unsigned long COLOUR_ALIGN_DOWN(
unsigned long addr,
20 if (base + off <= addr)
26 #define COLOUR_ALIGN(addr,pgoff) \
27 ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \
28 (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1)))
31 #define MIN_GAP (128*1024*1024UL)
32 #define MAX_GAP ((TASK_SIZE)/6*5)
34 static int mmap_is_legacy(
void)
45 static unsigned long mmap_base(
unsigned long rnd)
68 unsigned long len,
unsigned long pgoff,
unsigned long flags)
104 (!vma || addr + len <= vma->
vm_start))
134 if (!vma || addr + len <= vma->
vm_start) {
151 const unsigned long len,
const unsigned long pgoff,
152 const unsigned long flags)
156 unsigned long addr = addr0;
186 (!vma || addr + len <= vma->vm_start))
199 unsigned long base = COLOUR_ALIGN_DOWN(addr - len, pgoff);
206 if (!vma || addr <= vma->vm_start)
216 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
225 if (!vma || addr+len <= vma->vm_start)
236 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
237 }
while (len < vma->vm_start);
260 unsigned long random_factor = 0
UL;
267 if (mmap_is_legacy()) {
299 return !(pfn + (size >>
PAGE_SHIFT) > 0x00100000);
302 #ifdef CONFIG_STRICT_DEVMEM