patch-2.2.11 linux/mm/memory.c
Next file: linux/mm/mmap.c
Previous file: linux/lib/string.c
Back to the patch index
Back to the overall index
- Lines: 88
- Date:
Mon Aug 9 12:04:41 1999
- Orig file:
v2.2.10/linux/mm/memory.c
- Orig date:
Tue Jun 8 12:47:16 1999
diff -u --recursive --new-file v2.2.10/linux/mm/memory.c linux/mm/memory.c
@@ -52,7 +52,7 @@
*/
static inline void copy_cow_page(unsigned long from, unsigned long to)
{
- if (from == ZERO_PAGE) {
+ if (from == ZERO_PAGE(to)) {
clear_page(to);
return;
}
@@ -407,7 +407,8 @@
}
}
-static inline void zeromap_pte_range(pte_t * pte, unsigned long address, unsigned long size, pte_t zero_pte)
+static inline void zeromap_pte_range(pte_t * pte, unsigned long address,
+ unsigned long size, pgprot_t prot)
{
unsigned long end;
@@ -416,6 +417,8 @@
if (end > PMD_SIZE)
end = PMD_SIZE;
do {
+ pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(address),
+ prot));
pte_t oldpage = *pte;
set_pte(pte, zero_pte);
forget_pte(oldpage);
@@ -424,7 +427,8 @@
} while (address < end);
}
-static inline int zeromap_pmd_range(pmd_t * pmd, unsigned long address, unsigned long size, pte_t zero_pte)
+static inline int zeromap_pmd_range(pmd_t * pmd, unsigned long address,
+ unsigned long size, pgprot_t prot)
{
unsigned long end;
@@ -436,7 +440,7 @@
pte_t * pte = pte_alloc(pmd, address);
if (!pte)
return -ENOMEM;
- zeromap_pte_range(pte, address, end - address, zero_pte);
+ zeromap_pte_range(pte, address, end - address, prot);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
} while (address < end);
@@ -449,9 +453,7 @@
pgd_t * dir;
unsigned long beg = address;
unsigned long end = address + size;
- pte_t zero_pte;
- zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE, prot));
dir = pgd_offset(current->mm, address);
flush_cache_range(current->mm, beg, end);
while (address < end) {
@@ -459,7 +461,7 @@
error = -ENOMEM;
if (!pmd)
break;
- error = zeromap_pmd_range(pmd, address, end - address, zero_pte);
+ error = zeromap_pmd_range(pmd, address, end - address, prot);
if (error)
break;
address = (address + PGDIR_SIZE) & PGDIR_MASK;
@@ -811,9 +813,9 @@
/*
* This only needs the MM semaphore
*/
-static int do_anonymous_page(struct task_struct * tsk, struct vm_area_struct * vma, pte_t *page_table, int write_access)
+static int do_anonymous_page(struct task_struct * tsk, struct vm_area_struct * vma, pte_t *page_table, int write_access, unsigned long addr)
{
- pte_t entry = pte_wrprotect(mk_pte(ZERO_PAGE, vma->vm_page_prot));
+ pte_t entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot));
if (write_access) {
unsigned long page = __get_free_page(GFP_USER);
if (!page)
@@ -848,7 +850,8 @@
if (!vma->vm_ops || !vma->vm_ops->nopage) {
unlock_kernel();
- return do_anonymous_page(tsk, vma, page_table, write_access);
+ return do_anonymous_page(tsk, vma, page_table, write_access,
+ address);
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)