- Proc locking.
- P_INMEM -> PS_INMEM.
This commit is contained in:
parent
4cbdef8448
commit
16fdce5377
@ -816,19 +816,25 @@ pmap_new_proc(p)
|
||||
/*
|
||||
* allocate object for the upages
|
||||
*/
|
||||
PROC_LOCK(p);
|
||||
if ((upobj = p->p_upages_obj) == NULL) {
|
||||
PROC_UNLOCK(p);
|
||||
upobj = vm_object_allocate( OBJT_DEFAULT, UPAGES);
|
||||
PROC_LOCK(p);
|
||||
p->p_upages_obj = upobj;
|
||||
}
|
||||
|
||||
/* get a kernel virtual address for the UPAGES for this proc */
|
||||
if ((up = p->p_addr) == NULL) {
|
||||
PROC_UNLOCK(p);
|
||||
up = (struct user *) kmem_alloc_nofault(kernel_map,
|
||||
UPAGES * PAGE_SIZE);
|
||||
if (up == NULL)
|
||||
panic("pmap_new_proc: u_map allocation failed");
|
||||
PROC_LOCK(p);
|
||||
p->p_addr = up;
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
ptek = (unsigned *) vtopte((vm_offset_t) up);
|
||||
|
||||
|
@ -816,19 +816,25 @@ pmap_new_proc(p)
|
||||
/*
|
||||
* allocate object for the upages
|
||||
*/
|
||||
PROC_LOCK(p);
|
||||
if ((upobj = p->p_upages_obj) == NULL) {
|
||||
PROC_UNLOCK(p);
|
||||
upobj = vm_object_allocate( OBJT_DEFAULT, UPAGES);
|
||||
PROC_LOCK(p);
|
||||
p->p_upages_obj = upobj;
|
||||
}
|
||||
|
||||
/* get a kernel virtual address for the UPAGES for this proc */
|
||||
if ((up = p->p_addr) == NULL) {
|
||||
PROC_UNLOCK(p);
|
||||
up = (struct user *) kmem_alloc_nofault(kernel_map,
|
||||
UPAGES * PAGE_SIZE);
|
||||
if (up == NULL)
|
||||
panic("pmap_new_proc: u_map allocation failed");
|
||||
PROC_LOCK(p);
|
||||
p->p_addr = up;
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
ptek = (unsigned *) vtopte((vm_offset_t) up);
|
||||
|
||||
|
@ -85,8 +85,13 @@ procfs_read_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (fill_regs(p, regs));
|
||||
}
|
||||
|
||||
@ -95,8 +100,13 @@ procfs_write_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (set_regs(p, regs));
|
||||
}
|
||||
|
||||
@ -105,8 +115,13 @@ procfs_read_dbregs(p, dbregs)
|
||||
struct proc *p;
|
||||
struct dbreg *dbregs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (fill_dbregs(p, dbregs));
|
||||
}
|
||||
|
||||
@ -115,8 +130,13 @@ procfs_write_dbregs(p, dbregs)
|
||||
struct proc *p;
|
||||
struct dbreg *dbregs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (set_dbregs(p, dbregs));
|
||||
}
|
||||
|
||||
@ -130,8 +150,13 @@ procfs_read_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (fill_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
@ -140,8 +165,13 @@ procfs_write_fpregs(p, fpregs)
|
||||
struct proc *p;
|
||||
struct fpreg *fpregs;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (set_fpregs(p, fpregs));
|
||||
}
|
||||
|
||||
@ -149,7 +179,12 @@ int
|
||||
procfs_sstep(p)
|
||||
struct proc *p;
|
||||
{
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
|
||||
mtx_enter(&sched_lock, MTX_SPIN);
|
||||
if ((p->p_sflag & PS_INMEM) == 0) {
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (EIO);
|
||||
}
|
||||
mtx_exit(&sched_lock, MTX_SPIN);
|
||||
return (ptrace_single_step(p));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user