* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
* @(#)sys_process.c 7.16 (Berkeley) %G%
* Used to pass trace command from
* parent to child being traced.
* This data base cannot be
ptrace(curp
, uap
, retval
)
if (p
== 0 || p
->p_stat
!= SSTOP
|| p
->p_pptr
!= curp
||
sleep((caddr_t
)&ipc
, IPCPRI
);
sleep((caddr_t
)&ipc
, IPCPRI
);
((physadr)(p)+((o)/sizeof(((physadr)0)->r[0])))
* Code that the child process
* executes to implement the command
* of the parent process in tracing.
if (ipc
.ip_lock
!= p
->p_pid
)
case PT_READ_I
: /* read the child's text space */
if (!useracc((caddr_t
)ipc
.ip_addr
, 4, B_READ
))
ipc
.ip_data
= fuiword((caddr_t
)ipc
.ip_addr
);
case PT_READ_D
: /* read the child's data space */
if (!useracc((caddr_t
)ipc
.ip_addr
, 4, B_READ
))
ipc
.ip_data
= fuword((caddr_t
)ipc
.ip_addr
);
case PT_READ_U
: /* read the child's u. */
if (u
.u_pcb
.pcb_flags
& PCB_HPUXTRACE
)
i
= hpuxtobsduoff(ipc
.ip_addr
);
if (i
<0 || i
> ctob(UPAGES
)-sizeof(int))
ipc
.ip_data
= *(int *)PHYSOFF(&u
, i
);
case PT_WRITE_I
: /* write the child's text space */
if ((i
= suiword((caddr_t
)ipc
.ip_addr
, ipc
.ip_data
)) < 0) {
sa
= trunc_page((vm_offset_t
)ipc
.ip_addr
);
ea
= round_page((vm_offset_t
)ipc
.ip_addr
+sizeof(int)-1);
rv
= vm_map_protect(&p
->p_vmspace
->vm_map
, sa
, ea
,
if (rv
== KERN_SUCCESS
) {
i
= suiword((caddr_t
)ipc
.ip_addr
, ipc
.ip_data
);
(void) vm_map_protect(&p
->p_vmspace
->vm_map
,
sa
, ea
, VM_PROT_READ
|VM_PROT_EXECUTE
,
case PT_WRITE_D
: /* write the child's data space */
if (suword((caddr_t
)ipc
.ip_addr
, 0) < 0)
(void) suword((caddr_t
)ipc
.ip_addr
, ipc
.ip_data
);
case PT_WRITE_U
: /* write the child's u. */
if (u
.u_pcb
.pcb_flags
& PCB_HPUXTRACE
)
i
= hpuxtobsduoff(ipc
.ip_addr
);
poff
= (int *)PHYSOFF(&u
, i
);
for (i
=0; i
<NIPCREG
; i
++)
if (poff
== &p
->p_regs
[ipcreg
[i
]])
if (poff
== &p
->p_regs
[PS
]) {
ipc
.ip_data
|= PSL_USERSET
;
ipc
.ip_data
&= ~PSL_USERCLR
;
if (ipc
.ip_data
& PSL_CM
)
ipc
.ip_data
&= ~PSL_CM_CLR
;
if (poff
>= (int *)u
.u_pcb
.pcb_fpregs
.fpf_regs
&&
poff
<= (int *)&u
.u_pcb
.pcb_fpregs
.fpf_fpiar
)
case PT_STEP
: /* single step the child */
case PT_CONTINUE
: /* continue the child */
if ((int)ipc
.ip_addr
!= 1)
p
->p_regs
[PC
] = (int)ipc
.ip_addr
;
if ((unsigned)ipc
.ip_data
> NSIG
)
p
->p_xstat
= ipc
.ip_data
; /* see issig */
case PT_KILL
: /* kill the child process */
exit(p
, (int)p
->p_xstat
);