Beispiel #1
0
HIDDEN int
x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
  struct cursor *c = (struct cursor *) cursor;
  ucontext_t *uc = c->uc;

  /* Ensure c->pi is up-to-date.  On x86, it's relatively common to be
     missing DWARF unwind info.  We don't want to fail in that case,
     because the frame-chain still would let us do a backtrace at
     least.  */
  dwarf_make_proc_info (&c->dwarf);

  if (c->sigcontext_format == X86_SCF_NONE) {
      Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
      setcontext (uc);
      abort();
  } else if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) {
      struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;

      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
      sigreturn((ucontext_t *)((const char *)sc + FREEBSD_SC_UCONTEXT_OFF));
      abort();
  } else {
      Debug (8, "resuming at ip=%x for sigcontext format %d not implemented\n",
      c->dwarf.ip, c->sigcontext_format);
      abort();
  }
  return -UNW_EINVAL;
}
Beispiel #2
0
//Called after context has been placed on stack
void sigtramp(void (*handler)(void *), void *cntx, void *osp)
{
    void (*myHandler)(void *); 
    myHandler = handler;
    (*myHandler)(cntx);
    sigreturn(osp);
}
Beispiel #3
0
HIDDEN int
x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
  struct cursor *c = (struct cursor *) cursor;
  ucontext_t *uc = c->uc;

  /* Ensure c->pi is up-to-date.  On x86, it's relatively common to be
     missing DWARF unwind info.  We don't want to fail in that case,
     because the frame-chain still would let us do a backtrace at
     least.  */
  dwarf_make_proc_info (&c->dwarf);

  if (unlikely (c->sigcontext_format != X86_SCF_NONE))
    {
#if (!HAVE_SGX)
      struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;

      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
      sigreturn (sc);
#endif
    }
  else
    {
      Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
      setcontext (uc);
    }
  return -UNW_EINVAL;
}
Beispiel #4
0
void sigtramp(void (*handler)(void *), void *cntx, void *osp){
    
    //kprintf("in sigtramp\n");
    
    //while(1);
    
    handler(cntx);
    
    sigreturn(osp);
}
Beispiel #5
0
void sigtramp(void (*handler)(void *), void *contextFrame, void *old_sp) {
    kprintf("in sigtramp()\n");
    kprintf("Handler: %d\n", handler);
    
    kprintf("old_sp: %d\n", old_sp);
    
    context_frame* cFrame = (context_frame*) contextFrame;
    kprintf("context frame: %d; ebp: %d, esp: %d, eip: %d\n", 
            cFrame, cFrame->ebp, cFrame->esp, cFrame->iret_eip);
    
/*
    int i;
    for(i = 0; i < 100000000; i++);
*/
    handler(cFrame);
    sigreturn(old_sp);
    /* Control never gets back to here */
}
Beispiel #6
0
int sys_sigreturn(void){
	return sigreturn();
}