int md_getframe(struct pstate *ps, int frame, struct md_frame *fram) { struct frame fr; struct reg r; int count; if (process_getregs(ps, &r) != 0) return (-1); fr.fp = r.r_rbp; fr.pc = r.r_rip; for (count = 0; count < frame; count++) { if (process_read(ps, fr.fp, &fr, sizeof(fr)) < 0) return (-1); if (fr.pc < 0x1000) return (-1); } fram->pc = fr.pc; fram->fp = fr.fp; return (0); }
int md_getregs(struct pstate *ps, reg *r) { struct reg regs; #ifdef notyet struct fpreg fpregs; int rc; #endif if (process_getregs(ps, ®s) != 0) return (-1); bcopy(®s, r, sizeof(regs)); #ifdef notyet switch (rc = process_getfpregs(ps, &fpregs)) { case 0: bcopy(&fpregs, r + sizeof(regs) / sizeof(reg), sizeof(fpregs)); break; case EINVAL: bzero(r + sizeof(regs) / sizeof(reg), sizeof(fpregs)); break; default: return (-1); } #endif return (0); }
int md_getframe(struct pstate *ps, int frame, struct md_frame *fram) { struct frame64 fr; struct reg r; reg fp, pc; reg *outs; int i; if (process_getregs(ps, &r)) return (-1); if (frame == 0) { pc = r.r_pc; fp = r.r_out[6] + BIAS; /* * XXX - we need some kind of heuristics here to decide * if the function has done a save or not and then pick * the in registers. the problem is just that there are * no in registers in PT_GETREGS. */ outs = (reg *)&r.r_out; goto out; } fp = r.r_out[6] + BIAS; pc = r.r_out[7]; for (i = 1; i < frame; i++) { /* Too low or unaligned frame pointer? */ if (fp < 8192 || (fp & 7) != 0) return (-1); if (process_read(ps, fp, &fr, sizeof(fr)) < 0) return (-1); fp = (unsigned long)v9next_frame((&fr)); pc = fr.fr_pc; /* Too low or unaligned pc ? */ if ((pc < 8192) || (pc & 3) != 0) return (-1); outs = (reg *)&fr.fr_arg; } out: fram->pc = pc; fram->fp = fp; fram->nargs = 6; /* XXX - don't know the real number */ for (i = 0; i < 6; i++) { fram->args[i] = fr.fr_arg[i]; } return (0); }
int md_getregs(struct pstate *ps, reg *regs) { struct reg r; if (process_getregs(ps, &r)) return (-1); memcpy(regs, &r, sizeof(r)); return (0); }
int md_getframe(struct pstate *ps, int frame, struct md_frame *f) { struct reg regs; if (process_getregs(ps, ®s) != 0) return (-1); f->pc = regs.r_spc; f->fp = regs.r_r14; /* frame */ if (frame == 0) { f->nargs = 0; } else { f->nargs = 0; /* XXX for now */ } return (0); }
int md_getregs(struct pstate *ps, reg *regs) { struct reg r; int i; if (process_getregs(ps, &r)) return (-1); regs[0] = r.r_pc; regs[1] = r.r_npc; for (i = 0; i < 8; i++) { regs[2 + i] = r.r_out[i]; regs[10 + i] = r.r_in[i]; regs[18 + i] = r.r_global[i]; regs[26 + i] = r.r_local[i]; } return (0); }