Fix an off-by-one error when scanning the vm map for a page. Also, if the
page is not in core, don't recurse into shadow objects if we've already found a pager.
This commit is contained in:
parent
cfafc9262a
commit
9b8df6ad33
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char sccsid[] = "from: @(#)kvm.c 5.18 (Berkeley) 5/7/91";*/
|
/*static char sccsid[] = "from: @(#)kvm.c 5.18 (Berkeley) 5/7/91";*/
|
||||||
static char rcsid[] = "$Id: kvm.c,v 1.16 1993/08/15 01:54:29 mycroft Exp $";
|
static char rcsid[] = "$Id: kvm.c,v 1.17 1993/08/15 13:57:51 mycroft Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -1330,7 +1330,7 @@ struct swapblk *swb;
|
||||||
setsyserr("vatosw: read vm_map_entry");
|
setsyserr("vatosw: read vm_map_entry");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((vaddr >= vm_entry.start) && (vaddr <= vm_entry.end) &&
|
if ((vaddr >= vm_entry.start) && (vaddr < vm_entry.end) &&
|
||||||
(vm_entry.object.vm_object != 0))
|
(vm_entry.object.vm_object != 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1364,9 +1364,14 @@ struct swapblk *swb;
|
||||||
if (findpage(addr, off, maddr))
|
if (findpage(addr, off, maddr))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (vm_object.shadow == 0)
|
if (vm_object.pager != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (vm_object.shadow == 0) {
|
||||||
|
seterr("%u: no pager\n", p->p_pid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr, "%u: shadow obj at %x: offset %x+%x\n",
|
fprintf(stderr, "%u: shadow obj at %x: offset %x+%x\n",
|
||||||
p->p_pid, addr, off, vm_object.shadow_offset);
|
p->p_pid, addr, off, vm_object.shadow_offset);
|
||||||
|
@ -1376,11 +1381,6 @@ struct swapblk *swb;
|
||||||
off += vm_object.shadow_offset;
|
off += vm_object.shadow_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vm_object.pager) {
|
|
||||||
seterr("%u: no pager\n", p->p_pid);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find address in swap space */
|
/* Find address in swap space */
|
||||||
if (!KREAD(vm_object.pager, &pager, sizeof pager)) {
|
if (!KREAD(vm_object.pager, &pager, sizeof pager)) {
|
||||||
setsyserr("vatosw: read pager");
|
setsyserr("vatosw: read pager");
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
/*static char sccsid[] = "from: @(#)kvm.c 5.18 (Berkeley) 5/7/91";*/
|
/*static char sccsid[] = "from: @(#)kvm.c 5.18 (Berkeley) 5/7/91";*/
|
||||||
static char rcsid[] = "$Id: kvm.c,v 1.16 1993/08/15 01:54:29 mycroft Exp $";
|
static char rcsid[] = "$Id: kvm.c,v 1.17 1993/08/15 13:57:51 mycroft Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -1330,7 +1330,7 @@ struct swapblk *swb;
|
||||||
setsyserr("vatosw: read vm_map_entry");
|
setsyserr("vatosw: read vm_map_entry");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((vaddr >= vm_entry.start) && (vaddr <= vm_entry.end) &&
|
if ((vaddr >= vm_entry.start) && (vaddr < vm_entry.end) &&
|
||||||
(vm_entry.object.vm_object != 0))
|
(vm_entry.object.vm_object != 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1364,9 +1364,14 @@ struct swapblk *swb;
|
||||||
if (findpage(addr, off, maddr))
|
if (findpage(addr, off, maddr))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (vm_object.shadow == 0)
|
if (vm_object.pager != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (vm_object.shadow == 0) {
|
||||||
|
seterr("%u: no pager\n", p->p_pid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr, "%u: shadow obj at %x: offset %x+%x\n",
|
fprintf(stderr, "%u: shadow obj at %x: offset %x+%x\n",
|
||||||
p->p_pid, addr, off, vm_object.shadow_offset);
|
p->p_pid, addr, off, vm_object.shadow_offset);
|
||||||
|
@ -1376,11 +1381,6 @@ struct swapblk *swb;
|
||||||
off += vm_object.shadow_offset;
|
off += vm_object.shadow_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vm_object.pager) {
|
|
||||||
seterr("%u: no pager\n", p->p_pid);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find address in swap space */
|
/* Find address in swap space */
|
||||||
if (!KREAD(vm_object.pager, &pager, sizeof pager)) {
|
if (!KREAD(vm_object.pager, &pager, sizeof pager)) {
|
||||||
setsyserr("vatosw: read pager");
|
setsyserr("vatosw: read pager");
|
||||||
|
|
Loading…
Reference in New Issue