# if defined(SPARC) || defined(SPARC64)
val = sparc_regs.u_regs[U_REG_O1];
# elif defined(SH)
- if (upeek(tcp, 4*(REG_REG0+1), &val) < 0)
+ if (upeek(tcp->pid, 4*(REG_REG0+1), &val) < 0)
return -1;
# elif defined(IA64)
- if (upeek(tcp, PT_R9, &val) < 0)
+ if (upeek(tcp->pid, PT_R9, &val) < 0)
return -1;
# endif
tprintf("[%08lx] ", i386_regs.eip);
#elif defined(S390) || defined(S390X)
long psw;
- if (upeek(tcp, PT_PSWADDR, &psw) < 0) {
+ if (upeek(tcp->pid, PT_PSWADDR, &psw) < 0) {
PRINTBADPC;
return;
}
}
#elif defined(IA64)
long ip;
- if (upeek(tcp, PT_B0, &ip) < 0) {
+ if (upeek(tcp->pid, PT_B0, &ip) < 0) {
PRINTBADPC;
return;
}
# endif
#elif defined(M68K)
long pc;
- if (upeek(tcp, 4*PT_PC, &pc) < 0) {
+ if (upeek(tcp->pid, 4*PT_PC, &pc) < 0) {
tprints("[????????] ");
return;
}
tprintf("[%08lx] ", pc);
#elif defined(ALPHA)
long pc;
- if (upeek(tcp, REG_PC, &pc) < 0) {
+ if (upeek(tcp->pid, REG_PC, &pc) < 0) {
tprints("[????????????????] ");
return;
}
tprintf("[%08lx] ", sparc_regs.tpc);
#elif defined(HPPA)
long pc;
- if (upeek(tcp, PT_IAOQ0, &pc) < 0) {
+ if (upeek(tcp->pid, PT_IAOQ0, &pc) < 0) {
tprints("[????????] ");
return;
}
tprintf("[%08lx] ", pc);
#elif defined(MIPS)
long pc;
- if (upeek(tcp, REG_EPC, &pc) < 0) {
+ if (upeek(tcp->pid, REG_EPC, &pc) < 0) {
tprints("[????????] ");
return;
}
tprintf("[%08lx] ", pc);
#elif defined(SH)
long pc;
- if (upeek(tcp, 4*REG_PC, &pc) < 0) {
+ if (upeek(tcp->pid, 4*REG_PC, &pc) < 0) {
tprints("[????????] ");
return;
}
tprintf("[%08lx] ", pc);
#elif defined(SH64)
long pc;
- if (upeek(tcp, REG_PC, &pc) < 0) {
+ if (upeek(tcp->pid, REG_PC, &pc) < 0) {
tprints("[????????????????] ");
return;
}
tprintf("[%08lx] ", avr32_regs.pc);
#elif defined(BFIN)
long pc;
- if (upeek(tcp, PT_PC, &pc) < 0) {
+ if (upeek(tcp->pid, PT_PC, &pc) < 0) {
PRINTBADPC;
return;
}
tprintf("[%08lx] ", pc);
#elif defined(CRISV10)
long pc;
- if (upeek(tcp, 4*PT_IRP, &pc) < 0) {
+ if (upeek(tcp->pid, 4*PT_IRP, &pc) < 0) {
PRINTBADPC;
return;
}
tprintf("[%08lx] ", pc);
#elif defined(CRISV32)
long pc;
- if (upeek(tcp, 4*PT_ERP, &pc) < 0) {
+ if (upeek(tcp->pid, 4*PT_ERP, &pc) < 0) {
PRINTBADPC;
return;
}
tprintf("[%08lx] ", metag_regs.pc);
#elif defined(XTENSA)
long pc;
- if (upeek(tcp, REG_PC, &pc) < 0) {
+ if (upeek(tcp->pid, REG_PC, &pc) < 0) {
PRINTBADPC;
return;
}
long scno = 0;
#if defined(S390) || defined(S390X)
- if (upeek(tcp, PT_GPR2, &syscall_mode) < 0)
+ if (upeek(tcp->pid, PT_GPR2, &syscall_mode) < 0)
return -1;
if (syscall_mode != -ENOSYS) {
PT_GPR12, PT_GPR13, PT_GPR14, PT_GPR15
};
- if (upeek(tcp, PT_PSWADDR, &psw) < 0)
+ if (upeek(tcp->pid, PT_PSWADDR, &psw) < 0)
return -1;
errno = 0;
opcode = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(psw - sizeof(long)), 0);
tmp = 0;
offset_reg = (opcode & 0x000f0000) >> 16;
- if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp->pid, gpr_offset[offset_reg], &tmp) < 0))
return -1;
svc_addr += tmp;
tmp = 0;
offset_reg = (opcode & 0x0000f000) >> 12;
- if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp->pid, gpr_offset[offset_reg], &tmp) < 0))
return -1;
svc_addr += tmp;
# endif
tmp = 0;
offset_reg = (opcode & 0x00f00000) >> 20;
- if (offset_reg && (upeek(tcp, gpr_offset[offset_reg], &tmp) < 0))
+ if (offset_reg && (upeek(tcp->pid, gpr_offset[offset_reg], &tmp) < 0))
return -1;
scno = (scno | tmp) & 0xff;
#elif defined(AVR32)
scno = avr32_regs.r8;
#elif defined(BFIN)
- if (upeek(tcp, PT_ORIG_P0, &scno))
+ if (upeek(tcp->pid, PT_ORIG_P0, &scno))
return -1;
#elif defined(I386)
scno = i386_regs.orig_eax;
#elif defined(IA64)
# define IA64_PSR_IS ((long)1 << 34)
long psr;
- if (upeek(tcp, PT_CR_IPSR, &psr) >= 0)
+ if (upeek(tcp->pid, PT_CR_IPSR, &psr) >= 0)
ia32 = (psr & IA64_PSR_IS) != 0;
if (ia32) {
- if (upeek(tcp, PT_R1, &scno) < 0)
+ if (upeek(tcp->pid, PT_R1, &scno) < 0)
return -1;
} else {
- if (upeek(tcp, PT_R15, &scno) < 0)
+ if (upeek(tcp->pid, PT_R15, &scno) < 0)
return -1;
}
#elif defined(AARCH64)
scno = shuffle_scno(scno);
#elif defined(M68K)
- if (upeek(tcp, 4*PT_ORIG_D0, &scno) < 0)
+ if (upeek(tcp->pid, 4*PT_ORIG_D0, &scno) < 0)
return -1;
#elif defined(LINUX_MIPSN32)
unsigned long long regs[38];
}
}
#elif defined(MIPS)
- if (upeek(tcp, REG_A3, &mips_a3) < 0)
+ if (upeek(tcp->pid, REG_A3, &mips_a3) < 0)
return -1;
- if (upeek(tcp, REG_V0, &scno) < 0)
+ if (upeek(tcp->pid, REG_V0, &scno) < 0)
return -1;
if (!SCNO_IN_RANGE(scno)) {
}
}
#elif defined(ALPHA)
- if (upeek(tcp, REG_A3, &alpha_a3) < 0)
+ if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
return -1;
- if (upeek(tcp, REG_R0, &scno) < 0)
+ if (upeek(tcp->pid, REG_R0, &scno) < 0)
return -1;
/*
memmove(&sparc_regs.u_regs[U_REG_O0], &sparc_regs.u_regs[U_REG_O1], 7*sizeof(sparc_regs.u_regs[0]));
}
#elif defined(HPPA)
- if (upeek(tcp, PT_GR20, &scno) < 0)
+ if (upeek(tcp->pid, PT_GR20, &scno) < 0)
return -1;
#elif defined(SH)
/*
* In the new syscall ABI, the system call number is in R3.
*/
- if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0)
+ if (upeek(tcp->pid, 4*(REG_REG0+3), &scno) < 0)
return -1;
if (scno < 0) {
scno = correct_scno;
}
#elif defined(SH64)
- if (upeek(tcp, REG_SYSCALL, &scno) < 0)
+ if (upeek(tcp->pid, REG_SYSCALL, &scno) < 0)
return -1;
scno &= 0xFFFF;
#elif defined(CRISV10) || defined(CRISV32)
- if (upeek(tcp, 4*PT_R9, &scno) < 0)
+ if (upeek(tcp->pid, 4*PT_R9, &scno) < 0)
return -1;
#elif defined(TILE)
int currpers;
# endif
update_personality(tcp, currpers);
#elif defined(MICROBLAZE)
- if (upeek(tcp, 0, &scno) < 0)
+ if (upeek(tcp->pid, 0, &scno) < 0)
return -1;
#elif defined(OR1K)
scno = or1k_regs.gpr[11];
#elif defined(METAG)
scno = metag_regs.dx[0][1]; /* syscall number in D1Re0 (D1.0) */
#elif defined(XTENSA)
- if (upeek(tcp, SYSCALL_NR, &scno) < 0)
+ if (upeek(tcp->pid, SYSCALL_NR, &scno) < 0)
return -1;
#endif
* and stored it in syscall_mode, reuse it here
* instead of re-fetching?
*/
- if (upeek(tcp, PT_GPR2, &gpr2) < 0)
+ if (upeek(tcp->pid, PT_GPR2, &gpr2) < 0)
return -1;
if (syscall_mode != -ENOSYS)
syscall_mode = tcp->scno;
}
#elif defined(M68K)
/* TODO? Eliminate upeek's in arches below like we did in x86 */
- if (upeek(tcp, 4*PT_D0, &m68k_d0) < 0)
+ if (upeek(tcp->pid, 4*PT_D0, &m68k_d0) < 0)
return -1;
if (m68k_d0 != -ENOSYS) {
if (debug_flag)
return 0;
}
#elif defined(IA64)
- if (upeek(tcp, PT_R10, &ia64_r10) < 0)
+ if (upeek(tcp->pid, PT_R10, &ia64_r10) < 0)
return -1;
- if (upeek(tcp, PT_R8, &ia64_r8) < 0)
+ if (upeek(tcp->pid, PT_R8, &ia64_r8) < 0)
return -1;
if (ia32 && ia64_r8 != -ENOSYS) {
if (debug_flag)
return 0;
}
#elif defined(CRISV10) || defined(CRISV32)
- if (upeek(tcp, 4*PT_R10, &cris_r10) < 0)
+ if (upeek(tcp->pid, 4*PT_R10, &cris_r10) < 0)
return -1;
if (cris_r10 != -ENOSYS) {
if (debug_flag)
return 0;
}
#elif defined(MICROBLAZE)
- if (upeek(tcp, 3 * 4, µblaze_r3) < 0)
+ if (upeek(tcp->pid, 3 * 4, µblaze_r3) < 0)
return -1;
if (microblaze_r3 != -ENOSYS) {
if (debug_flag)
#if defined(S390) || defined(S390X)
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, i==0 ? PT_ORIGGPR2 : PT_GPR2 + i*sizeof(long), &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, i==0 ? PT_ORIGGPR2 : PT_GPR2 + i*sizeof(long), &tcp->u_arg[i]) < 0)
return -1;
#elif defined(ALPHA)
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, REG_A0+i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, REG_A0+i, &tcp->u_arg[i]) < 0)
return -1;
#elif defined(IA64)
if (!ia32) {
# define PT_RBS_END PT_AR_BSP
# endif
- if (upeek(tcp, PT_RBS_END, &rbs_end) < 0)
+ if (upeek(tcp->pid, PT_RBS_END, &rbs_end) < 0)
return -1;
- if (upeek(tcp, PT_CFM, (long *) &cfm) < 0)
+ if (upeek(tcp->pid, PT_CFM, (long *) &cfm) < 0)
return -1;
sof = (cfm >> 0) & 0x7f;
PT_R13 /* EBP = out5 */};
for (i = 0; i < nargs; ++i) {
- if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, argreg[i], &tcp->u_arg[i]) < 0)
return -1;
/* truncate away IVE sign-extension */
tcp->u_arg[i] &= 0xffffffff;
if (nargs > 4) {
long sp;
- if (upeek(tcp, REG_SP, &sp) < 0)
+ if (upeek(tcp->pid, REG_SP, &sp) < 0)
return -1;
for (i = 0; i < 4; ++i)
- if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, REG_A0 + i, &tcp->u_arg[i]) < 0)
return -1;
umoven(tcp, sp + 16, (nargs - 4) * sizeof(tcp->u_arg[0]),
(char *)(tcp->u_arg + 4));
} else {
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, REG_A0 + i, &tcp->u_arg[i]) < 0)
return -1;
}
#elif defined(POWERPC)
tcp->u_arg[i] = sparc_regs.u_regs[U_REG_O0 + i];
#elif defined(HPPA)
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
return -1;
#elif defined(ARM) || defined(AARCH64)
# if defined(AARCH64)
static const int argreg[MAX_ARGS] = { PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5 };
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, argreg[i], &tcp->u_arg[i]) < 0)
return -1;
#elif defined(SH)
static const int syscall_regs[MAX_ARGS] = {
};
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, syscall_regs[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, syscall_regs[i], &tcp->u_arg[i]) < 0)
return -1;
#elif defined(SH64)
int i;
static const int syscall_regs[MAX_ARGS] = { 2, 3, 4, 5, 6, 7 };
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, REG_GENERAL(syscall_regs[i]), &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, REG_GENERAL(syscall_regs[i]), &tcp->u_arg[i]) < 0)
return -1;
#elif defined(I386)
(void)i;
}
#elif defined(MICROBLAZE)
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, (5 + i) * 4, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, (5 + i) * 4, &tcp->u_arg[i]) < 0)
return -1;
#elif defined(CRISV10) || defined(CRISV32)
static const int crisregs[MAX_ARGS] = {
};
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, crisregs[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, crisregs[i], &tcp->u_arg[i]) < 0)
return -1;
#elif defined(TILE)
for (i = 0; i < nargs; ++i)
tcp->u_arg[i] = tile_regs.regs[i];
#elif defined(M68K)
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, (i < 5 ? i : i + 2)*4, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, (i < 5 ? i : i + 2)*4, &tcp->u_arg[i]) < 0)
return -1;
#elif defined(OR1K)
(void)nargs;
/* arg0: a6, arg1: a3, arg2: a4, arg3: a5, arg4: a8, arg5: a9 */
static const int xtensaregs[MAX_ARGS] = { 6, 3, 4, 5, 8, 9 };
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, REG_A_BASE + xtensaregs[i], &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, REG_A_BASE + xtensaregs[i], &tcp->u_arg[i]) < 0)
return -1;
#else /* Other architecture (32bits specific) */
for (i = 0; i < nargs; ++i)
- if (upeek(tcp, i*4, &tcp->u_arg[i]) < 0)
+ if (upeek(tcp->pid, i*4, &tcp->u_arg[i]) < 0)
return -1;
#endif
return 1;
get_syscall_result(struct tcb *tcp)
{
#if defined(S390) || defined(S390X)
- if (upeek(tcp, PT_GPR2, &gpr2) < 0)
+ if (upeek(tcp->pid, PT_GPR2, &gpr2) < 0)
return -1;
#elif defined(POWERPC)
# define SO_MASK 0x10000000
#elif defined(AVR32)
/* already done by get_regs */
#elif defined(BFIN)
- if (upeek(tcp, PT_R0, &bfin_r0) < 0)
+ if (upeek(tcp->pid, PT_R0, &bfin_r0) < 0)
return -1;
#elif defined(I386)
/* already done by get_regs */
#elif defined(IA64)
# define IA64_PSR_IS ((long)1 << 34)
long psr;
- if (upeek(tcp, PT_CR_IPSR, &psr) >= 0)
+ if (upeek(tcp->pid, PT_CR_IPSR, &psr) >= 0)
ia32 = (psr & IA64_PSR_IS) != 0;
- if (upeek(tcp, PT_R8, &ia64_r8) < 0)
+ if (upeek(tcp->pid, PT_R8, &ia64_r8) < 0)
return -1;
- if (upeek(tcp, PT_R10, &ia64_r10) < 0)
+ if (upeek(tcp->pid, PT_R10, &ia64_r10) < 0)
return -1;
#elif defined(ARM)
/* already done by get_regs */
*/
/*update_personality(tcp, aarch64_io.iov_len == sizeof(aarch64_regs));*/
#elif defined(M68K)
- if (upeek(tcp, 4*PT_D0, &m68k_d0) < 0)
+ if (upeek(tcp->pid, 4*PT_D0, &m68k_d0) < 0)
return -1;
#elif defined(LINUX_MIPSN32)
unsigned long long regs[38];
mips_a3 = regs[REG_A3];
mips_r2 = regs[REG_V0];
#elif defined(MIPS)
- if (upeek(tcp, REG_A3, &mips_a3) < 0)
+ if (upeek(tcp->pid, REG_A3, &mips_a3) < 0)
return -1;
- if (upeek(tcp, REG_V0, &mips_r2) < 0)
+ if (upeek(tcp->pid, REG_V0, &mips_r2) < 0)
return -1;
#elif defined(ALPHA)
- if (upeek(tcp, REG_A3, &alpha_a3) < 0)
+ if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
return -1;
- if (upeek(tcp, REG_R0, &alpha_r0) < 0)
+ if (upeek(tcp->pid, REG_R0, &alpha_r0) < 0)
return -1;
#elif defined(SPARC) || defined(SPARC64)
/* already done by get_regs */
#elif defined(HPPA)
- if (upeek(tcp, PT_GR28, &hppa_r28) < 0)
+ if (upeek(tcp->pid, PT_GR28, &hppa_r28) < 0)
return -1;
#elif defined(SH)
/* new syscall ABI returns result in R0 */
- if (upeek(tcp, 4*REG_REG0, (long *)&sh_r0) < 0)
+ if (upeek(tcp->pid, 4*REG_REG0, (long *)&sh_r0) < 0)
return -1;
#elif defined(SH64)
/* ABI defines result returned in r9 */
- if (upeek(tcp, REG_GENERAL(9), (long *)&sh64_r9) < 0)
+ if (upeek(tcp->pid, REG_GENERAL(9), (long *)&sh64_r9) < 0)
return -1;
#elif defined(CRISV10) || defined(CRISV32)
- if (upeek(tcp, 4*PT_R10, &cris_r10) < 0)
+ if (upeek(tcp->pid, 4*PT_R10, &cris_r10) < 0)
return -1;
#elif defined(TILE)
/* already done by get_regs */
#elif defined(MICROBLAZE)
- if (upeek(tcp, 3 * 4, µblaze_r3) < 0)
+ if (upeek(tcp->pid, 3 * 4, µblaze_r3) < 0)
return -1;
#elif defined(OR1K)
/* already done by get_regs */
#elif defined(METAG)
/* already done by get_regs */
#elif defined(XTENSA)
- if (upeek(tcp, REG_A_BASE + 2, &xtensa_a2) < 0)
+ if (upeek(tcp->pid, REG_A_BASE + 2, &xtensa_a2) < 0)
return -1;
#endif
return 1;