This time, really make the procfs work when reading stuff from the UPAGES.

This is a really ugly bandaid on the problem, but it works well enough for
'ps -u' to start working again.  The problem was caused by the user
address space shrinking by a little bit and the UPAGES being "cast off" to
become a seperate entity rather than being at the top of the process's
vmspace.  That optimization was part of John's most recent VM speedups.

Now, rather than decoding the VM space, it merely ensures the pages are
in core and accesses them the same way the ptrace(PT_READ_U..) code does,
ie: off the p->p_addr pointer.
This commit is contained in:
Peter Wemm 1996-01-25 06:05:38 +00:00
parent 1e19193647
commit f863805df0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13627
2 changed files with 68 additions and 30 deletions

View file

@ -37,7 +37,7 @@
*
* @(#)procfs_mem.c 8.4 (Berkeley) 1/21/94
*
* $Id: procfs_mem.c,v 1.15 1996/01/19 03:58:32 dyson Exp $
* $Id: procfs_mem.c,v 1.16 1996/01/24 18:41:06 peter Exp $
*/
/*
@ -96,20 +96,6 @@ procfs_rwmem(p, uio)
int fix_prot;
uva = (vm_offset_t) uio->uio_offset;
if (uva >= VM_MAXUSER_ADDRESS) {
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
error = 0;
break;
}
/* we are reading the "U area", fill it in */
PHOLD(p);
if (p->p_flag & P_INMEM) {
p->p_addr->u_kproc.kp_proc = *p;
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
}
PRELE(p);
}
/*
* Get the page number of this segment.
@ -122,6 +108,39 @@ procfs_rwmem(p, uio)
*/
len = min(PAGE_SIZE - page_offset, uio->uio_resid);
if (uva >= VM_MAXUSER_ADDRESS) {
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
error = 0;
break;
}
/* we are reading the "U area", force it into core */
PHOLD(p);
/* sanity check */
if (!(p->p_flag & P_INMEM)) {
/* aiee! */
error = EFAULT;
break;
}
/* populate the ptrace/procfs area */
p->p_addr->u_kproc.kp_proc = *p;
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
/* locate the in-core address */
kva = (u_int)p->p_addr + uva - VM_MAXUSER_ADDRESS;
/* transfer it */
error = uiomove((caddr_t)kva, len, uio);
/* let the pages go */
PRELE(p);
continue;
}
/*
* The map we want...
*/

View file

@ -37,7 +37,7 @@
*
* @(#)procfs_mem.c 8.4 (Berkeley) 1/21/94
*
* $Id: procfs_mem.c,v 1.15 1996/01/19 03:58:32 dyson Exp $
* $Id: procfs_mem.c,v 1.16 1996/01/24 18:41:06 peter Exp $
*/
/*
@ -96,20 +96,6 @@ procfs_rwmem(p, uio)
int fix_prot;
uva = (vm_offset_t) uio->uio_offset;
if (uva >= VM_MAXUSER_ADDRESS) {
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
error = 0;
break;
}
/* we are reading the "U area", fill it in */
PHOLD(p);
if (p->p_flag & P_INMEM) {
p->p_addr->u_kproc.kp_proc = *p;
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
}
PRELE(p);
}
/*
* Get the page number of this segment.
@ -122,6 +108,39 @@ procfs_rwmem(p, uio)
*/
len = min(PAGE_SIZE - page_offset, uio->uio_resid);
if (uva >= VM_MAXUSER_ADDRESS) {
if (writing || (uva >= (VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE))) {
error = 0;
break;
}
/* we are reading the "U area", force it into core */
PHOLD(p);
/* sanity check */
if (!(p->p_flag & P_INMEM)) {
/* aiee! */
error = EFAULT;
break;
}
/* populate the ptrace/procfs area */
p->p_addr->u_kproc.kp_proc = *p;
fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
/* locate the in-core address */
kva = (u_int)p->p_addr + uva - VM_MAXUSER_ADDRESS;
/* transfer it */
error = uiomove((caddr_t)kva, len, uio);
/* let the pages go */
PRELE(p);
continue;
}
/*
* The map we want...
*/