core/win32/callback.c
/* heuristic check whether an exception is due to execution or due to
 * a read from unreadable memory */
heuristic check whether an exception is due to execution or due to
a read from unreadable memory
heuristic check whether an exception is due to execution or due to a read from unreadable memory
static bool
is_execution_exception(EXCEPTION_RECORD *pExcptRec)
{
    app_pc fault_pc = pExcptRec->ExceptionAddress;
    app_pc target = (app_pc) pExcptRec->ExceptionInformation[1];
    bool execution = false;
    ASSERT(pExcptRec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION);
    if (pExcptRec->ExceptionInformation[0] == 
        EXCEPTION_INFORMATION_EXECUTE_FAULT) {
        execution = true;
    }
    if (pExcptRec->ExceptionInformation[0] == 
        EXCEPTION_INFORMATION_READ_EXECUTE_FAULT) {
        if (fault_pc == target) {
            execution = true;
        } else if (fault_pc < target && 
                   target < fault_pc + MAX_INSTR_LENGTH) {
            execution = true;   
            ASSERT_NOT_IMPLEMENTED(false);
        } else {
            execution = false;
        }
    }
    return execution;
}
static bool is_execution_exception ( EXCEPTION_RECORD * pExcptRec ) { app_pc fault_pc = pExcptRec -> ExceptionAddress ; app_pc target = ( app_pc ) pExcptRec -> ExceptionInformation [ 1 ] ; bool execution = false ; ASSERT ( pExcptRec -> ExceptionCode == EXCEPTION_ACCESS_VIOLATION ) ; if ( pExcptRec -> ExceptionInformation [ 0 ] == EXCEPTION_INFORMATION_EXECUTE_FAULT ) { execution = true ; } if ( pExcptRec -> ExceptionInformation [ 0 ] == EXCEPTION_INFORMATION_READ_EXECUTE_FAULT ) { if ( fault_pc == target ) { execution = true ; } else if ( fault_pc < target && target < fault_pc + MAX_INSTR_LENGTH ) { execution = true ; ASSERT_NOT_IMPLEMENTED ( false ) ; } else { execution = false ; } } return execution ; }
heuristic check whether an exception is due to execution or due to
 a read from unreadable memory
heuristic check whether an exception is due to execution or due to a read from unreadable memory
/* certainly execution */ /* FIXME: case 5879 should know if running on an NX capable
     * machine and whether this information code depends on whether
     * the current application is NX compatible. Verify that if this
     * is not set, it is expected to be just a read fault.  For the
     * time being using the read/execute heuristic all the time 
     */ /* certainly execution */ /* near a page boundary crossing a read exception can
             * happen either while reading the instruction (execution)
             * or while the instruction is reading from a nearby
             * location.  Without decoding cannot say which one is it,
             * but most likely it is execution.
             */ /* unclear whether execution or read */ /* if we are not crossing a page boundary we can't
             * possibly fail, so should ASSERT on that, and also on
             * is_readable_without_exception() to make sure we don't
             * have a race
             */ /* execution more likely */ /* FIXME: case 1948 actually has to deal with this more
             * precisely when instructions may cross pages with
             * different permissions */ /* read otherwise */