ARM: OMAP2+: Prepare to move GPMC to drivers by platform data header
[linux/fpc-iii.git] / arch / x86 / um / mem_32.c
blobf40281e5d6a27430e5aa018dba8861bcf4a208b6
1 /*
2 * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #include <linux/mm.h>
10 #include <asm/page.h>
11 #include <asm/mman.h>
13 static struct vm_area_struct gate_vma;
15 static int __init gate_vma_init(void)
17 if (!FIXADDR_USER_START)
18 return 0;
20 gate_vma.vm_mm = NULL;
21 gate_vma.vm_start = FIXADDR_USER_START;
22 gate_vma.vm_end = FIXADDR_USER_END;
23 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
24 gate_vma.vm_page_prot = __P101;
26 return 0;
28 __initcall(gate_vma_init);
30 struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
32 return FIXADDR_USER_START ? &gate_vma : NULL;
35 int in_gate_area_no_mm(unsigned long addr)
37 if (!FIXADDR_USER_START)
38 return 0;
40 if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END))
41 return 1;
43 return 0;
46 int in_gate_area(struct mm_struct *mm, unsigned long addr)
48 struct vm_area_struct *vma = get_gate_vma(mm);
50 if (!vma)
51 return 0;
53 return (addr >= vma->vm_start) && (addr < vma->vm_end);