{
struct ucontext *uctx = (struct ucontext *) ctx;
- printf("callertrap(mctx) by 0x%08x\n", uctx->uc_mcontext.eip);
+ printf("callertrap(mctx) by 0x%08x\n", (unsigned int) uctx->uc_mcontext.eip);
// printf("callertrap(addr) by 0x%08x\n", info->si_addr);
// printf("callertrap(*esp) by 0x%08x\n", * (unsigned int *) uctx->uc_mcontext.esp);
unsigned int *to_patch = (unsigned int *) (uctx->uc_mcontext.eip + 2);
- unsigned char *insn = (unsigned int *) (uctx->uc_mcontext.eip);
+ unsigned char *insn = (unsigned char *) (uctx->uc_mcontext.eip);
*insn = 0x90; // nop
insn++;
*insn = 0xe8; // call
- printf(" to_patch: 0x%08x\n", to_patch);
+ printf(" to_patch: 0x%08x\n", (unsigned int) to_patch);
printf("*to_patch: 0x%08x\n", *to_patch);
if (*to_patch != 0x00000000) {
printf("something is wrong here. abort\n");
}
*to_patch = (unsigned int) patchme - ((unsigned int) insn + 5);
printf("*to_patch: 0x%08x\n", *to_patch);
- uctx->uc_mcontext.eip = insn;
+ uctx->uc_mcontext.eip = (unsigned long) insn;
// while (1) ;
}