diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-07-31 22:57:10 +0000 |
---|---|---|
committer | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1997-07-31 22:57:10 +0000 |
commit | 9765588f1533bde5f6af8056525368b301d72989 (patch) | |
tree | eecfacde0115baf8cd67323981b2e20404fc683d /mm | |
parent | 5fd44fa07fcc1a00e75622a2ae5f6463a6c06be0 (diff) |
Changes required to share a piece of memory between kernel in
interrupt-land and a user application.
Vmalloc is now an inline function that calls vmalloc_prot with
the original protection bits used in vmalloc.
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmalloc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index d0270d586..5b1387c7f 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -83,7 +83,7 @@ void vmfree_area_pages(unsigned long address, unsigned long size) flush_tlb_all(); } -static inline int alloc_area_pte(pte_t * pte, unsigned long address, unsigned long size) +static inline int alloc_area_pte(pte_t * pte, unsigned long address, unsigned long size, pgprot_t prot) { unsigned long end; @@ -98,14 +98,14 @@ static inline int alloc_area_pte(pte_t * pte, unsigned long address, unsigned lo page = __get_free_page(GFP_KERNEL); if (!page) return -ENOMEM; - set_pte(pte, mk_pte(page, PAGE_KERNEL)); + set_pte(pte, mk_pte(page, prot)); address += PAGE_SIZE; pte++; } return 0; } -static inline int alloc_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size) +static inline int alloc_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, pgprot_t prot) { unsigned long end; @@ -117,7 +117,7 @@ static inline int alloc_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo pte_t * pte = pte_alloc_kernel(pmd, address); if (!pte) return -ENOMEM; - if (alloc_area_pte(pte, address, end - address)) + if (alloc_area_pte(pte, address, end - address, prot)) return -ENOMEM; address = (address + PMD_SIZE) & PMD_MASK; pmd++; @@ -125,7 +125,7 @@ static inline int alloc_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo return 0; } -int vmalloc_area_pages(unsigned long address, unsigned long size) +int vmalloc_area_pages(unsigned long address, unsigned long size, pgprot_t prot) { pgd_t * dir; unsigned long end = address + size; @@ -136,7 +136,7 @@ int vmalloc_area_pages(unsigned long address, unsigned long size) pmd_t *pmd = pmd_alloc_kernel(dir, address); if (!pmd) return -ENOMEM; - if (alloc_area_pmd(pmd, address, end - address)) + if (alloc_area_pmd(pmd, address, end - address, prot)) return -ENOMEM; set_pgdir(address, *dir); address = (address + PGDIR_SIZE) & PGDIR_MASK; @@ -189,7 +189,7 @@ void vfree(void * addr) printk("Trying to vfree() nonexistent vm area (%p)\n", addr); } -void * vmalloc(unsigned long size) +void * vmalloc_prot(unsigned long size, pgprot_t prot) { void * addr; struct vm_struct *area; @@ -201,7 +201,7 @@ void * vmalloc(unsigned long size) if (!area) return NULL; addr = area->addr; - if (vmalloc_area_pages(VMALLOC_VMADDR(addr), size)) { + if (vmalloc_area_pages(VMALLOC_VMADDR(addr), size, PAGE_KERNEL)) { vfree(addr); return NULL; } |