diff options
author | Hugh Dickins <hugh@veritas.com> | 2006-07-26 16:39:49 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-07-26 19:58:39 -0400 |
commit | 804af2cf6e7af31d2e664b54e657dddd9b531dbd (patch) | |
tree | a9127236c76953ddc627b8133aae208651e206fd | |
parent | 64821324ca49f24be1a66f2f432108f96a24e596 (diff) |
[AGPGART] remove private page protection map
AGP keeps its own copy of the protection_map, upcoming DRM changes will
also require access to this map from modules.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r-- | drivers/char/agp/frontend.c | 27 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | mm/mmap.c | 7 |
3 files changed, 10 insertions, 25 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index d9c5a9142ad1..0f2ed2aa2d81 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client, | |||
151 | client->segments = seg; | 151 | client->segments = seg; |
152 | } | 152 | } |
153 | 153 | ||
154 | /* Originally taken from linux/mm/mmap.c from the array | ||
155 | * protection_map. | ||
156 | * The original really should be exported to modules, or | ||
157 | * some routine which does the conversion for you | ||
158 | */ | ||
159 | |||
160 | static const pgprot_t my_protect_map[16] = | ||
161 | { | ||
162 | __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, | ||
163 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | ||
164 | }; | ||
165 | |||
166 | static pgprot_t agp_convert_mmap_flags(int prot) | 154 | static pgprot_t agp_convert_mmap_flags(int prot) |
167 | { | 155 | { |
168 | #define _trans(x,bit1,bit2) \ | ||
169 | ((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0) | ||
170 | |||
171 | unsigned long prot_bits; | 156 | unsigned long prot_bits; |
172 | pgprot_t temp; | ||
173 | |||
174 | prot_bits = _trans(prot, PROT_READ, VM_READ) | | ||
175 | _trans(prot, PROT_WRITE, VM_WRITE) | | ||
176 | _trans(prot, PROT_EXEC, VM_EXEC); | ||
177 | |||
178 | prot_bits |= VM_SHARED; | ||
179 | 157 | ||
180 | temp = my_protect_map[prot_bits & 0x0000000f]; | 158 | prot_bits = calc_vm_prot_bits(prot) | VM_SHARED; |
181 | 159 | return vm_get_page_prot(prot_bits); | |
182 | return temp; | ||
183 | } | 160 | } |
184 | 161 | ||
185 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) | 162 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 990957e0929f..4fba4560699b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1012,6 +1012,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) | |||
1012 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 1012 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | pgprot_t vm_get_page_prot(unsigned long vm_flags); | ||
1015 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); | 1016 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); |
1016 | struct page *vmalloc_to_page(void *addr); | 1017 | struct page *vmalloc_to_page(void *addr); |
1017 | unsigned long vmalloc_to_pfn(void *addr); | 1018 | unsigned long vmalloc_to_pfn(void *addr); |
@@ -60,6 +60,13 @@ pgprot_t protection_map[16] = { | |||
60 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | 60 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | pgprot_t vm_get_page_prot(unsigned long vm_flags) | ||
64 | { | ||
65 | return protection_map[vm_flags & | ||
66 | (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; | ||
67 | } | ||
68 | EXPORT_SYMBOL(vm_get_page_prot); | ||
69 | |||
63 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | 70 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ |
64 | int sysctl_overcommit_ratio = 50; /* default is 50% */ | 71 | int sysctl_overcommit_ratio = 50; /* default is 50% */ |
65 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; | 72 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |