Commit 804af2cf authored by Hugh Dickins's avatar Hugh Dickins Committed by Dave Jones

[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: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 64821324
...@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client, ...@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client,
client->segments = seg; client->segments = seg;
} }
/* Originally taken from linux/mm/mmap.c from the array
* protection_map.
* The original really should be exported to modules, or
* some routine which does the conversion for you
*/
static const pgprot_t my_protect_map[16] =
{
__P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
};
static pgprot_t agp_convert_mmap_flags(int prot) static pgprot_t agp_convert_mmap_flags(int prot)
{ {
#define _trans(x,bit1,bit2) \
((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0)
unsigned long prot_bits; unsigned long prot_bits;
pgprot_t temp;
prot_bits = _trans(prot, PROT_READ, VM_READ) |
_trans(prot, PROT_WRITE, VM_WRITE) |
_trans(prot, PROT_EXEC, VM_EXEC);
prot_bits |= VM_SHARED;
temp = my_protect_map[prot_bits & 0x0000000f]; prot_bits = calc_vm_prot_bits(prot) | VM_SHARED;
return vm_get_page_prot(prot_bits);
return temp;
} }
static int agp_create_segment(struct agp_client *client, struct agp_region *region) static int agp_create_segment(struct agp_client *client, struct agp_region *region)
......
...@@ -1012,6 +1012,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) ...@@ -1012,6 +1012,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
} }
pgprot_t vm_get_page_prot(unsigned long vm_flags);
struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
struct page *vmalloc_to_page(void *addr); struct page *vmalloc_to_page(void *addr);
unsigned long vmalloc_to_pfn(void *addr); unsigned long vmalloc_to_pfn(void *addr);
......
...@@ -60,6 +60,13 @@ pgprot_t protection_map[16] = { ...@@ -60,6 +60,13 @@ pgprot_t protection_map[16] = {
__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 __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_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
int sysctl_overcommit_ratio = 50; /* default is 50% */ int sysctl_overcommit_ratio = 50; /* default is 50% */
int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment