Lines Matching refs:P

60 Pabort_agent(struct ps_prochandle *P)  in Pabort_agent()  argument
62 int sysnum = P->status.pr_lwp.pr_syscall; in Pabort_agent()
66 (void) Pstop(P, 0); in Pabort_agent()
67 stop = Psysexit(P, sysnum, TRUE); in Pabort_agent()
69 if (Psetrun(P, 0, PRSABORT) == 0) { in Pabort_agent()
70 while (Pwait(P, 0) == -1 && errno == EINTR) in Pabort_agent()
72 (void) Psysexit(P, sysnum, stop); in Pabort_agent()
81 Pcreate_agent(struct ps_prochandle *P) in Pcreate_agent() argument
94 if (P->agentcnt > 0) { in Pcreate_agent()
95 P->agentcnt++; in Pcreate_agent()
103 if (P->state == PS_DEAD || P->state == PS_UNDEAD || in Pcreate_agent()
104 P->state == PS_IDLE) { in Pcreate_agent()
113 (void) Pstop(P, 0); in Pcreate_agent()
114 Psync(P); in Pcreate_agent()
115 if (!(P->status.pr_lwp.pr_flags & PR_AGENT)) { in Pcreate_agent()
117 (void) memcpy(&cmd.regs, &P->status.pr_lwp.pr_reg[0], in Pcreate_agent()
118 sizeof (P->status.pr_lwp.pr_reg)); in Pcreate_agent()
119 if (write(P->ctlfd, &cmd, sizeof (cmd)) != sizeof (cmd)) in Pcreate_agent()
124 (void) Pstopstatus(P, PCNULL, 0); in Pcreate_agent()
128 procfs_path, (int)P->pid); in Pcreate_agent()
142 P->agentstatfd = fd; in Pcreate_agent()
148 P->agentctlfd = fd; in Pcreate_agent()
155 if ((P->status.pr_lwp.pr_flags & PR_ASLEEP) || in Pcreate_agent()
156 ((P->status.pr_lwp.pr_flags & PR_STOPPED) && in Pcreate_agent()
157 P->status.pr_lwp.pr_why == PR_SYSENTRY)) { in Pcreate_agent()
159 (P->status.pr_lwp.pr_flags & PR_ASLEEP) ? in Pcreate_agent()
161 Pabort_agent(P); in Pcreate_agent()
165 P->agentcnt++; in Pcreate_agent()
166 if (Pstopstatus(P, PCNULL, 0) != 0) { in Pcreate_agent()
167 Pdestroy_agent(P); in Pcreate_agent()
174 if (P->agentstatfd >= 0) in Pcreate_agent()
175 (void) close(P->agentstatfd); in Pcreate_agent()
176 if (P->agentctlfd >= 0) in Pcreate_agent()
177 (void) close(P->agentctlfd); in Pcreate_agent()
178 P->agentstatfd = -1; in Pcreate_agent()
179 P->agentctlfd = -1; in Pcreate_agent()
181 (void) Pstopstatus(P, PCNULL, 0); in Pcreate_agent()
190 Pdestroy_agent(struct ps_prochandle *P) in Pdestroy_agent() argument
192 if (P->agentcnt > 1) in Pdestroy_agent()
193 P->agentcnt--; in Pdestroy_agent()
197 Psync(P); /* Flush out any pending changes */ in Pdestroy_agent()
199 (void) Pstopstatus(P, PCNULL, 0); in Pdestroy_agent()
200 flags = P->status.pr_lwp.pr_flags; in Pdestroy_agent()
208 Pabort_agent(P); in Pdestroy_agent()
216 (void) pr_lwp_exit(P); in Pdestroy_agent()
217 (void) close(P->agentctlfd); in Pdestroy_agent()
218 (void) close(P->agentstatfd); in Pdestroy_agent()
219 P->agentctlfd = -1; in Pdestroy_agent()
220 P->agentstatfd = -1; in Pdestroy_agent()
221 P->agentcnt = 0; in Pdestroy_agent()
227 (void) Pstopstatus(P, PCNULL, 0); in Pdestroy_agent()
235 execute(struct ps_prochandle *P, int sysindex) in execute() argument
237 int ctlfd = (P->agentctlfd >= 0)? P->agentctlfd : P->ctlfd; in execute()
247 sentry = Psysentry(P, sysindex, TRUE); /* set stop-on-syscall-entry */ in execute()
252 if (memcmp(&P->status.pr_lwp.pr_lwphold, &blockable_sigs, in execute()
254 hold = P->status.pr_lwp.pr_lwphold; in execute()
255 P->status.pr_lwp.pr_lwphold = blockable_sigs; in execute()
256 P->flags |= SETHOLD; in execute()
263 if ((cursig = P->status.pr_lwp.pr_cursig) != 0) { in execute()
265 ctl.siginfo = P->status.pr_lwp.pr_info; in execute()
268 if (Psetrun(P, 0, PRCSIG | PRCFAULT) == -1) in execute()
271 while (P->state == PS_RUN) { in execute()
272 (void) Pwait(P, 0); in execute()
274 if (P->state != PS_STOP) in execute()
280 P->status.pr_lwp.pr_lwphold = hold; in execute()
281 P->flags |= SETHOLD; in execute()
284 (void) Psysentry(P, sysindex, sentry); /* restore sysentry stop */ in execute()
286 if (P->status.pr_lwp.pr_why == PR_SYSENTRY && in execute()
287 P->status.pr_lwp.pr_what == sysindex) in execute()
298 Psyscall(struct ps_prochandle *P, in Psyscall() argument
324 if (P->state == PS_DEAD || P->state == PS_UNDEAD || P->state == PS_IDLE) in Psyscall()
327 model = P->status.pr_dmodel; in Psyscall()
339 if (Pcreate_agent(P) != 0) in Psyscall()
346 save_pstatus = P->status; in Psyscall()
348 if (P->state != PS_STOP || /* check state of LWP */ in Psyscall()
349 (P->status.pr_flags & PR_ASLEEP)) in Psyscall()
352 if (Pscantext(P)) /* bad text ? */ in Psyscall()
361 sp = P->status.pr_lwp.pr_reg[R_SP] + STACK_BIAS; in Psyscall()
375 sp = (uint32_t)P->status.pr_lwp.pr_reg[R_SP]; in Psyscall()
423 ap = Psyscall_setup(P, nargs, sysindex, sp); in Psyscall()
424 P->flags |= SETREGS; /* set registers before continuing */ in Psyscall()
430 if (execute(P, sysindex) != 0 || in Psyscall()
431 (!Pissyscall(P, P->status.pr_lwp.pr_reg[R_PC]) && in Psyscall()
432 !Pissyscall_prev(P, P->status.pr_lwp.pr_reg[R_PC], NULL))) in Psyscall()
446 if (Pwrite(P, adp->arg_object, adp->arg_size, in Psyscall()
452 if (Psyscall_copyinargs(P, nargs, argp, ap) != 0) in Psyscall()
461 sexit = Psysexit(P, sysindex, TRUE); /* catch this syscall exit */ in Psyscall()
463 if (Psetrun(P, 0, 0) == -1) in Psyscall()
465 while (P->state == PS_RUN) in Psyscall()
466 (void) Pwait(P, 0); in Psyscall()
467 } while (P->state == PS_STOP && P->status.pr_lwp.pr_why != PR_SYSEXIT); in Psyscall()
468 (void) Psysexit(P, sysindex, sexit); /* restore original setting */ in Psyscall()
480 if (P->state != PS_STOP || P->status.pr_lwp.pr_why != PR_SYSEXIT) in Psyscall()
483 if (P->status.pr_lwp.pr_what != sysindex) in Psyscall()
486 if (!Pissyscall_prev(P, P->status.pr_lwp.pr_reg[R_PC], NULL)) { in Psyscall()
501 if (Pread(P, adp->arg_object, adp->arg_size, in Psyscall()
507 if (Psyscall_copyoutargs(P, nargs, argp, ap) != 0) in Psyscall()
513 if (P->status.pr_lwp.pr_errno) { /* error return */ in Psyscall()
514 error = P->status.pr_lwp.pr_errno; in Psyscall()
520 rval->sys_rval1 = P->status.pr_lwp.pr_rval1; in Psyscall()
521 rval->sys_rval2 = P->status.pr_lwp.pr_rval2; in Psyscall()
523 P->status.pr_lwp.pr_rval1, P->status.pr_lwp.pr_rval2); in Psyscall()
562 if (P->state != PS_UNDEAD) { in Psyscall()
563 P->status = save_pstatus; in Psyscall()
564 P->flags |= SETREGS; in Psyscall()
565 Psync(P); in Psyscall()
567 Pdestroy_agent(P); in Psyscall()