Ignore:
Timestamp:
Apr 5, 2006, 11:20:20 AM (14 years ago)
Author:
gb
Message:

Do some callbacks. Let's see if they work yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/x86-exceptions.c

    r4042 r4045  
    252252}
    253253
     254int
     255callback_to_lisp (TCR * tcr, LispObj callback_macptr, ExceptionInformation *xp,
     256                  natural arg1, natural arg2, natural arg3, natural arg4, natural arg5)
     257{
     258  sigset_t mask;
     259  natural  callback_ptr, i;
     260  int delta;
     261
     262
     263
     264  /* Put the active stack pointers where .SPcallback expects them */
     265  tcr->save_vsp = (LispObj *) xpGPR(xp, Isp);
     266  tcr->save_tsp = (LispObj *) xpMMXreg(xp, Itsp);
     267
     268
     269
     270  /* Call back.
     271     Lisp will handle trampolining through some code that
     272     will push lr/fn & pc/nfn stack frames for backtrace.
     273  */
     274  callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;
     275  UNLOCK(lisp_global(EXCEPTION_LOCK), tcr);
     276  delta = ((int (*)())callback_ptr) (xp, arg1, arg2, arg3, arg4, arg5);
     277  LOCK(lisp_global(EXCEPTION_LOCK), tcr);
     278  return delta;
     279}
     280
     281void
     282callback_for_interrupt(TCR *tcr, ExceptionInformation *xp)
     283{
     284  callback_to_lisp(tcr, nrs_CMAIN.vcell,xp, 0, 0, 0, 0, 0);
     285}
     286
     287
     288Boolean
     289handle_fault(TCR *tcr, ExceptionInformation *xp, siginfo_t *info)
     290{
     291  return false;
     292}
     293
    254294Boolean
    255295handle_exception(int signum, siginfo_t *info, ExceptionInformation  *context, TCR *tcr)
     
    257297  pc program_counter = (pc)xpPC(context);
    258298
    259   if (signum == SIGSEGV) {
     299  switch (signum) {
     300  case SIGSEGV:
    260301    if ((info->si_addr) == 0) {
    261302      /* Something mapped to SIGSEGV that has nothing to do with
     
    283324
    284325        }
     326      } else if ((program_counter[0] == XUUO_OPCODE_0) &&
     327                 (program_counter[1] == XUUO_OPCODE_1)) {
     328        switch (program_counter[2]) {
     329        case XUUO_TLB_TOO_SMALL:
     330          return false;
     331          break;
     332         
     333        case XUUO_INTERRUPT_NOW:
     334          callback_for_interrupt(tcr,context);
     335          xpPC(xp)+=3;
     336          return true;
     337
     338        default:
     339          return false;
     340        }
     341      } else {
     342        return false;
    285343      }
    286     }
     344
     345    } else {
     346      return handle_fault(tcr, context, info);
     347    }
     348    break;
     349
     350  case SIGNAL_FOR_PROCESS_INTERRUPT:
     351    callback_for_interrupt(tcr, context);
     352    return true;
     353    break;
     354   
     355   
    287356  }
    288357  return false;
Note: See TracChangeset for help on using the changeset viewer.