Changeset 6405 for branches/x8664-call


Ignore:
Timestamp:
May 4, 2007, 3:32:20 AM (13 years ago)
Author:
gb
Message:

Arrange to pass old_valence through exception handlers, so we're
less likely to treat memory faults from foreign code as lisp errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/x8664-call/ccl/lisp-kernel/ppc-exceptions.c

    r6281 r6405  
    868868
    869869OSStatus
    870 handle_protection_violation(ExceptionInformation *xp, siginfo_t *info, TCR *tcr)
     870handle_protection_violation(ExceptionInformation *xp, siginfo_t *info, TCR *tcr, int old_valence)
    871871{
    872872  BytePtr addr;
     
    884884  if (addr && (addr == tcr->safe_ref_address)) {
    885885    adjust_exception_pc(xp,4);
     886
    886887    xpGPR(xp,imm0) = 0;
    887888    return 0;
     
    902903    }
    903904  }
    904   callback_for_trap(nrs_CMAIN.vcell, xp, (pc)xpPC(xp), SIGBUS, (natural)addr, is_write_fault(xp,info));
     905  if (old_valence == TCR_STATE_LISP) {
     906    callback_for_trap(nrs_CMAIN.vcell, xp, (pc)xpPC(xp), SIGBUS, (natural)addr, is_write_fault(xp,info));
     907  }
    905908  return -1;
    906909}
     
    12071210                       ExceptionInformation *xp,
    12081211                       TCR *tcr,
    1209                        siginfo_t *info)
     1212                       siginfo_t *info,
     1213                       int old_valence)
    12101214{
    12111215  unsigned oldMQ;
     
    12251229  } else if ((xnum == SIGSEGV) ||
    12261230             (xnum == SIGBUS)) {
    1227     status = handle_protection_violation(xp, info, tcr);
     1231    status = handle_protection_violation(xp, info, tcr, old_valence);
    12281232  } else if (xnum == SIGFPE) {
    12291233    status = handle_sigfpe(xp, tcr);
     
    17291733
    17301734void
    1731 signal_handler(int signum, siginfo_t *info, ExceptionInformation  *context, TCR *tcr)
     1735signal_handler(int signum, siginfo_t *info, ExceptionInformation  *context, TCR *tcr, int old_valence)
    17321736{
    17331737  xframe_list xframe_link;
    1734   int old_valence;
    17351738
    17361739  if (running_under_rosetta) {
     
    17521755 
    17531756  wait_for_exception_lock_in_handler(tcr, context, &xframe_link);
    1754   if ((noErr != PMCL_exception_handler(signum, context, tcr, info))) {
     1757  if ((noErr != PMCL_exception_handler(signum, context, tcr, info, old_valence))) {
    17551758    char msg[512];
    17561759    snprintf(msg, sizeof(msg), "Unhandled exception %d at 0x%lx, context->regs at #x%lx", signum, xpPC(context), (natural)xpGPRvector(context));
     
    20482051          fprintf(stderr, "[0x%x acquired exception lock for interrupt]\n",tcr);
    20492052#endif
    2050           PMCL_exception_handler(signum, context, tcr, info);
     2053          PMCL_exception_handler(signum, context, tcr, info, old_valence);
    20512054          if (disp) {
    20522055            xpGPR(context,allocptr) -= disp;
     
    24982501  mach_msg_type_number_t thread_state_count;
    24992502  ExceptionInformation *pseudosigcontext;
    2500   int i, j;
     2503  int i, j, old_valence = tcr->valence;
    25012504  kern_return_t result;
    25022505  natural stackp;
     
    25242527  ts.__r4 = (natural)pseudosigcontext;
    25252528  ts.__r5 = (natural)tcr;
     2529  ts.__r6 = (natural)old_valence;
    25262530  ts.__lr = (natural)pseudo_sigreturn;
    25272531
     
    25472551
    25482552void
    2549 pseudo_signal_handler(int signum, ExceptionInformation *context, TCR *tcr)
    2550 {
    2551   signal_handler(signum, NULL, context, tcr);
     2553pseudo_signal_handler(int signum, ExceptionInformation *context, TCR *tcr, int old_valence)
     2554{
     2555  signal_handler(signum, NULL, context, tcr, old_valence);
    25522556}
    25532557
Note: See TracChangeset for help on using the changeset viewer.