Ignore:
Timestamp:
Dec 27, 2010, 3:51:30 AM (9 years ago)
Author:
gb
Message:

Handle SIGILL specially: if a conditional UUO causes an exception
when the condition isn't met, ignore it.

(Conditional UUOs are being phased out, since this adds significant
overhead.)

File:
1 edited

Legend:

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

    r14515 r14517  
    13941394}
    13951395
     1396
     1397void
     1398sigill_handler(int signum, siginfo_t *info, ExceptionInformation  *xp)
     1399{
     1400  pc program_counter = xpPC(xp);
     1401  opcode instr = *program_counter;
     1402
     1403  if (IS_UUO(instr)) {
     1404    natural psr = xpPSR(xp);
     1405    Boolean opcode_matched_condition = false,
     1406      flip = ((instr & (1<<28)) != 0);
     1407   
     1408
     1409    switch (instr >> 29) {
     1410    case 0:
     1411      opcode_matched_condition = ((psr & PSR_Z_MASK) != 0);
     1412      break;
     1413    case 1:
     1414      opcode_matched_condition = ((psr & PSR_C_MASK) != 0);
     1415      break;
     1416    case 2:
     1417      opcode_matched_condition = ((psr & PSR_N_MASK) != 0);
     1418      break;
     1419    case 3:
     1420      opcode_matched_condition = ((psr & PSR_V_MASK) != 0);
     1421      break;
     1422    case 4:
     1423      opcode_matched_condition = (((psr & PSR_C_MASK) != 0) &&
     1424                                  ((psr & PSR_Z_MASK) == 0));
     1425      break;
     1426    case 5:
     1427      opcode_matched_condition = (((psr & PSR_N_MASK) != 0) ==
     1428                                  ((psr & PSR_V_MASK) != 0));
     1429      break;
     1430    case 6:
     1431      opcode_matched_condition = ((((psr & PSR_N_MASK) != 0) ==
     1432                                   ((psr & PSR_V_MASK) != 0)) &&
     1433                                  ((psr & PSR_Z_MASK) == 0));
     1434      break;
     1435    case 7:
     1436      opcode_matched_condition = true;
     1437      flip = false;
     1438      break;
     1439    }
     1440    if (flip) {
     1441      opcode_matched_condition = !opcode_matched_condition;
     1442    }
     1443    if (!opcode_matched_condition) {
     1444      adjust_exception_pc(xp,4);
     1445      return;
     1446    }
     1447  }
     1448  signal_handler(signum,info,xp, NULL, 0, 0);
     1449}
     1450
     1451
    13961452#ifdef USE_SIGALTSTACK
    13971453void
     
    17231779    ;
    17241780  if (install_signal_handlers_for_exceptions) {
    1725     install_signal_handler(SIGILL, (void *)signal_handler, true, false);
     1781    install_signal_handler(SIGILL, (void *)sigill_handler, true, false);
    17261782    install_signal_handler(SIGSEGV, (void *)ALTSTACK(signal_handler),true, true);
    17271783
Note: See TracChangeset for help on using the changeset viewer.