patch-1.3.87 linux/mm/memory.c
Next file: linux/mm/mremap.c
Previous file: linux/mm/filemap.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Thu Apr 11 15:26:39 1996
- Orig file:
v1.3.86/linux/mm/memory.c
- Orig date:
Fri Apr 5 13:35:28 1996
diff -u --recursive --new-file v1.3.86/linux/mm/memory.c linux/mm/memory.c
@@ -195,7 +195,7 @@
return;
}
page_nr = MAP_NR(pte_page(pte));
- if (page_nr >= MAP_NR(high_memory) || mem_map[page_nr].reserved) {
+ if (page_nr >= MAP_NR(high_memory) || PageReserved(mem_map+page_nr)) {
set_pte(new_pte, pte);
return;
}
@@ -308,7 +308,7 @@
return;
if (pte_present(page)) {
unsigned long addr = pte_page(page);
- if (addr >= high_memory || mem_map[MAP_NR(addr)].reserved)
+ if (addr >= high_memory || PageReserved(mem_map+MAP_NR(addr)))
return;
free_page(addr);
if (current->mm->rss <= 0)
@@ -467,7 +467,7 @@
do {
pte_t oldpage = *pte;
pte_clear(pte);
- if (offset >= high_memory || mem_map[MAP_NR(offset)].reserved)
+ if (offset >= high_memory || PageReserved(mem_map+MAP_NR(offset)))
set_pte(pte, mk_pte(offset, prot));
forget_pte(oldpage);
address += PAGE_SIZE;
@@ -624,7 +624,7 @@
*/
if (mem_map[MAP_NR(old_page)].count != 1) {
if (new_page) {
- if (mem_map[MAP_NR(old_page)].reserved)
+ if (PageReserved(mem_map + MAP_NR(old_page)))
++vma->vm_mm->rss;
copy_page(old_page,new_page);
flush_page_to_ram(old_page);
@@ -677,18 +677,14 @@
* case where we use a fake user buffer with get_fs/set_fs()) we
* don't expect to find the address in the user vm map.
*/
- if (!size || get_fs() == get_ds())
+ if (!size || get_fs() == KERNEL_DS)
return 0;
vma = find_vma(current, start);
if (!vma)
goto bad_area;
- if (vma->vm_start <= start)
- goto good_area;
- if (!(vma->vm_flags & VM_GROWSDOWN))
- goto bad_area;
- if (expand_stack(vma, start))
- goto bad_area;
+ if (vma->vm_start > start)
+ goto check_stack;
good_area:
if (type == VERIFY_WRITE)
@@ -742,6 +738,12 @@
goto bad_area;;
}
return 0;
+
+check_stack:
+ if (!(vma->vm_flags & VM_GROWSDOWN))
+ goto bad_area;
+ if (expand_stack(vma, start))
+ goto good_area;
bad_area:
return -EFAULT;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this