Changeset 13989


Ignore:
Timestamp:
Jul 19, 2010, 2:45:39 PM (9 years ago)
Author:
gb
Message:

Let callback functions decide whether/how to advance PC on return.

Location:
branches/arm/lisp-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/lisp-kernel/arm-exceptions.c

    r13962 r13989  
    276276  */
    277277  xpGPR(xp,allocptr) = xpGPR(xp,allocbase) = VOID_ALLOCPTR;
    278   handle_error(xp, bytes_needed < (128<<10) ? XNOMEM : error_alloc_failed,0);
     278  handle_error(xp, bytes_needed < (128<<10) ? XNOMEM : error_alloc_failed,0, NULL);
    279279}
    280280
     
    515515  lisp_global(CS_OVERFLOW_LIMIT) = CS_OVERFLOW_FORCE_LIMIT; /* force unsigned traps to fail */
    516516#endif
    517   handle_error(xp, error_stack_overflow, reg);
     517  handle_error(xp, error_stack_overflow, reg, NULL);
    518518}
    519519
     
    829829  extern void touch_page_end(void);
    830830
     831#ifdef LINUX
     832  addr = (BytePtr) ((natural) (xpFaultAddress(xp)));
     833#else
    831834  if (info) {
    832835    addr = (BytePtr)(info->si_addr);
     
    834837    addr = (BytePtr) ((natural) (xpFaultAddress(xp)));
    835838  }
     839#endif
    836840
    837841  if (addr && (addr == tcr->safe_ref_address)) {
     
    869873      (header_subtag(header_of(cmain)) == subtag_macptr)) {
    870874     
    871       callback_for_trap(nrs_CMAIN.vcell, xp, is_write_fault(xp,info)?SIGBUS:SIGSEGV, (natural)addr);
     875      callback_for_trap(nrs_CMAIN.vcell, xp, is_write_fault(xp,info)?SIGBUS:SIGSEGV, (natural)addr, NULL);
    872876    }
    873877  }
     
    10111015  } else if (xnum == SIGNAL_FOR_PROCESS_INTERRUPT) {
    10121016    tcr->interrupt_pending = 0;
    1013     callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0);
     1017    callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0, NULL);
    10141018    return true;
    10151019  }
     
    11191123    case 4:
    11201124      tcr->interrupt_pending = 0;
    1121       callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0);
     1125      callback_for_trap(nrs_CMAIN.vcell, xp, 0, 0, &bump);
    11221126      handled = true;
    11231127      break;
     
    11351139  case uuo_format_unary_error:
    11361140  case uuo_format_binary_error:
    1137     handled = handle_error(xp,0,the_uuo);
     1141    handled = handle_error(xp,0,the_uuo, &bump);
    11381142    break;
    11391143
     
    11671171
    11681172Boolean
    1169 callback_for_trap (LispObj callback_macptr, ExceptionInformation *xp, natural info,natural arg)
    1170 {
    1171   return callback_to_lisp(callback_macptr, xp, info,arg);
     1173callback_for_trap (LispObj callback_macptr, ExceptionInformation *xp, natural info,natural arg, int *bumpP)
     1174{
     1175  return callback_to_lisp(callback_macptr, xp, info,arg, bumpP);
    11721176}
    11731177
    11741178Boolean
    11751179callback_to_lisp (LispObj callback_macptr, ExceptionInformation *xp,
    1176                   natural arg1, natural arg2)
     1180                  natural arg1, natural arg2, int *bumpP)
    11771181{
    11781182  natural  callback_ptr;
     
    11801184  natural fnreg = fn,  codevector, offset;
    11811185  pc where = xpPC(xp);
     1186  int delta;
    11821187
    11831188  codevector = register_codevector_contains_pc(xpGPR(xp,fnreg), where);
     
    12151220  callback_ptr = ((macptr *)ptr_from_lispobj(untag(callback_macptr)))->address;
    12161221  UNLOCK(lisp_global(EXCEPTION_LOCK), tcr);
    1217   ((void (*)())callback_ptr) (xp, arg1, arg2, fnreg, offset);
     1222  delta = ((int (*)())callback_ptr) (xp, arg1, arg2, fnreg, offset);
    12181223  LOCK(lisp_global(EXCEPTION_LOCK), tcr);
    12191224
    1220 
     1225  if (bumpP) {
     1226    *bumpP = delta;
     1227  }
    12211228
    12221229  /* Copy GC registers back into exception frame */
     
    12631270
    12641271Boolean
    1265 handle_error(ExceptionInformation *xp, unsigned arg1, unsigned arg2)
     1272handle_error(ExceptionInformation *xp, unsigned arg1, unsigned arg2, int *bumpP)
    12661273{
    12671274  LispObj   errdisp = nrs_ERRDISP.vcell;
     
    12701277      (header_subtag(header_of(errdisp)) == subtag_macptr)) {
    12711278    /* errdisp is a macptr, we can call back to lisp */
    1272     return callback_for_trap(errdisp, xp, arg1, arg2);
     1279    return callback_for_trap(errdisp, xp, arg1, arg2, bumpP);
    12731280    }
    12741281
  • branches/arm/lisp-kernel/arm-exceptions.h

    r13941 r13989  
    4949
    5050int
    51 callback_for_trap (LispObj, ExceptionInformation *, natural, natural);
     51callback_for_trap (LispObj, ExceptionInformation *, natural, natural, int*);
    5252
    5353natural
     
    5555
    5656int
    57 callback_to_lisp (LispObj, ExceptionInformation *, natural, natural);
     57callback_to_lisp (LispObj, ExceptionInformation *, natural, natural, int*);
    5858
    5959OSStatus
     
    9494
    9595OSStatus
    96 handle_error(ExceptionInformation *, unsigned, unsigned);
     96handle_error(ExceptionInformation *, unsigned, unsigned, int*);
    9797
    9898typedef char* vector_buf;
Note: See TracChangeset for help on using the changeset viewer.