dlls/ntdll/signal_x86_64.c
/**********************************************************************
 *		segv_handler
 *
 * Handler for SIGSEGV and related errors.
 */
segv_handler
Handler for SIGSEGV and related errors.
segv_handler Handler for SIGSEGV and related errors .
static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{
    EXCEPTION_RECORD *rec = setup_exception( sigcontext, raise_segv_exception );
    ucontext_t *ucontext = sigcontext;
    switch(TRAP_sig(ucontext))
    {
    case TRAP_x86_OFLOW:   
        rec->ExceptionCode = EXCEPTION_INT_OVERFLOW;
        break;
    case TRAP_x86_BOUND:   
        rec->ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
        break;
    case TRAP_x86_PRIVINFLT:   
        rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
        break;
    case TRAP_x86_STKFLT:  
        rec->ExceptionCode = EXCEPTION_STACK_OVERFLOW;
        break;
    case TRAP_x86_SEGNPFLT:  
    case TRAP_x86_PROTFLT:   
    case TRAP_x86_UNKNOWN:   
        rec->ExceptionCode = ERROR_sig(ucontext) ? EXCEPTION_ACCESS_VIOLATION : EXCEPTION_PRIV_INSTRUCTION;
        rec->ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
        break;
    case TRAP_x86_PAGEFLT:  
        rec->ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
        rec->NumberParameters = 2;
        rec->ExceptionInformation[0] = (ERROR_sig(ucontext) & 2) != 0;
        rec->ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
        break;
    case TRAP_x86_ALIGNFLT:  
        rec->ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
        break;
    default:
        ERR( "Got unexpected trap %ld\n", TRAP_sig(ucontext) );
    case TRAP_x86_NMI:       
    case TRAP_x86_DNA:       
    case TRAP_x86_DOUBLEFLT: 
    case TRAP_x86_TSSFLT:    
    case TRAP_x86_MCHK:      
    case TRAP_x86_CACHEFLT:  
        rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
        break;
    }
}
static void segv_handler ( int signal , siginfo_t * siginfo , void * sigcontext ) { EXCEPTION_RECORD * rec = setup_exception ( sigcontext , raise_segv_exception ) ; ucontext_t * ucontext = sigcontext ; switch ( TRAP_sig ( ucontext ) ) { case TRAP_x86_OFLOW : rec -> ExceptionCode = EXCEPTION_INT_OVERFLOW ; break ; case TRAP_x86_BOUND : rec -> ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED ; break ; case TRAP_x86_PRIVINFLT : rec -> ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION ; break ; case TRAP_x86_STKFLT : rec -> ExceptionCode = EXCEPTION_STACK_OVERFLOW ; break ; case TRAP_x86_SEGNPFLT : case TRAP_x86_PROTFLT : case TRAP_x86_UNKNOWN : rec -> ExceptionCode = ERROR_sig ( ucontext ) ? EXCEPTION_ACCESS_VIOLATION : EXCEPTION_PRIV_INSTRUCTION ; rec -> ExceptionCode = EXCEPTION_ACCESS_VIOLATION ; break ; case TRAP_x86_PAGEFLT : rec -> ExceptionCode = EXCEPTION_ACCESS_VIOLATION ; rec -> NumberParameters = 2 ; rec -> ExceptionInformation [ 0 ] = ( ERROR_sig ( ucontext ) & 2 ) != 0 ; rec -> ExceptionInformation [ 1 ] = ( ULONG_PTR ) siginfo -> si_addr ; break ; case TRAP_x86_ALIGNFLT : rec -> ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT ; break ; default : ERR ( " \n " , TRAP_sig ( ucontext ) ) ; case TRAP_x86_NMI : case TRAP_x86_DNA : case TRAP_x86_DOUBLEFLT : case TRAP_x86_TSSFLT : case TRAP_x86_MCHK : case TRAP_x86_CACHEFLT : rec -> ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION ; break ; } }
segv_handler
 Handler for SIGSEGV and related errors.
segv_handler Handler for SIGSEGV and related errors .
/* Overflow exception */ /* Bound range exception */ /* Invalid opcode exception */ /* Stack fault */ /* Segment not present exception */ /* General protection fault */ /* Unknown fault code */ /* Page fault */ /* Alignment check exception */ /* fall through */ /* NMI interrupt */ /* Device not available exception */ /* Double fault exception */ /* Invalid TSS exception */ /* Machine check exception */ /* Cache flush exception */