* Copyright (c) 1982, 1986 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.1 (Berkeley) %G%
#include "../machine/reg.h"
#include "../machine/psl.h"
#include "../machine/pte.h"
* Used to pass trace command from
* parent to child being traced.
* This data base cannot be
uap
= (struct a
*)u
.u_ap
;
u
.u_procp
->p_flag
|= STRC
;
if (p
== 0 || p
->p_stat
!= SSTOP
|| p
->p_ppid
!= u
.u_procp
->p_pid
||
sleep((caddr_t
)&ipc
, IPCPRI
);
sleep((caddr_t
)&ipc
, IPCPRI
);
u
.u_r
.r_val1
= ipc
.ip_data
;
{R0
,R1
,R2
,R3
,R4
,R5
,R6
,R7
,R8
,R9
,R10
,R11
,AP
,FP
,SP
,PC
};
((physadr)(p)+((o)/sizeof(((physadr)0)->r[0])))
* Code that the child process
* executes to implement the command
* of the parent process in tracing.
register struct text
*xp
;
if (ipc
.ip_lock
!= u
.u_procp
->p_pid
)
u
.u_procp
->p_slptime
= 0;
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 (i
<0 || i
>= ctob(UPAGES
))
ipc
.ip_data
= *(int *)PHYSOFF(&u
, i
);
case PT_WRITE_I
: /* write the child's text space */
* If text, must assure exclusive use
if (xp
= u
.u_procp
->p_textp
) {
if (xp
->x_count
!=1 || xp
->x_iptr
->i_mode
&ISVTX
)
if ((i
= suiword((caddr_t
)ipc
.ip_addr
, ipc
.ip_data
)) < 0) {
if (chgprot((caddr_t
)ipc
.ip_addr
, RW
) &&
chgprot((caddr_t
)ipc
.ip_addr
+(sizeof(int)-1), RW
))
i
= suiword((caddr_t
)ipc
.ip_addr
, ipc
.ip_data
);
(void) chgprot((caddr_t
)ipc
.ip_addr
, RO
);
(void) chgprot((caddr_t
)ipc
.ip_addr
+(sizeof(int)-1), RO
);
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. */
p
= (int *)PHYSOFF(&u
, i
);
for (i
=0; i
<NIPCREG
; i
++)
if (p
== &u
.u_ar0
[ipcreg
[i
]])
ipc
.ip_data
|= PSL_USERSET
;
ipc
.ip_data
&= ~PSL_USERCLR
;
case PT_STEP
: /* single step the child */
case PT_CONTINUE
: /* continue the child */
if ((int)ipc
.ip_addr
!= 1)
u
.u_ar0
[PC
] = (int)ipc
.ip_addr
;
if ((unsigned)ipc
.ip_data
> NSIG
)
u
.u_procp
->p_cursig
= ipc
.ip_data
; /* see issig */
case PT_KILL
: /* kill the child process */
exit(u
.u_procp
->p_cursig
);