示例#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;
}
示例#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);
}
示例#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;
}
示例#4
0
文件: signal.c 项目: CoffeeJack/CS415
void sigtramp(void (*handler)(void *), void *cntx, void *osp){
    
    //kprintf("in sigtramp\n");
    
    //while(1);
    
    handler(cntx);
    
    sigreturn(osp);
}
示例#5
0
文件: signal.c 项目: hairice/Cs415-a1
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 */
}
示例#6
0
int sys_sigreturn(void){
	return sigreturn();
}