From b073f281ad350f9b029379f44d543ee6a2f622cd Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 5 Jul 2012 23:09:17 +0200 Subject: [PATCH] Get rid of the SIGFPE handler If shit happens, let it crash. --- neo/sys/linux/main.cpp | 10 --------- neo/sys/osx/DOOMController.mm | 41 ---------------------------------- neo/sys/posix/posix_public.h | 1 - neo/sys/posix/posix_signal.cpp | 10 +-------- 4 files changed, 1 insertion(+), 61 deletions(-) diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index b2a82dc2..e1c6c164 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.cpp @@ -120,16 +120,6 @@ void Sys_Shutdown( void ) { Posix_Shutdown(); } -/* -=============== -Sys_FPE_handler -=============== -*/ -void Sys_FPE_handler( int signum, siginfo_t *info, void *context ) { - assert( signum == SIGFPE ); - Sys_Printf( "FPE\n" ); -} - /* ================ Sys_GetSystemRam diff --git a/neo/sys/osx/DOOMController.mm b/neo/sys/osx/DOOMController.mm index bfb62414..bb0cda1d 100644 --- a/neo/sys/osx/DOOMController.mm +++ b/neo/sys/osx/DOOMController.mm @@ -79,47 +79,6 @@ void Sys_Shutdown( void ) { Posix_Shutdown(); } -/* -=============== -Sys_FPE_handler -=============== -*/ -void Sys_FPE_handler( int signum, siginfo_t *info, void *context ) { -#if defined(__ppc__) - int ret; - ppc_float_state_t *fs; - ppc_thread_state_t *ss; - - fs = &( (struct ucontext *)context )->uc_mcontext->fs; - ss = &( (struct ucontext *)context )->uc_mcontext->ss; - - Sys_Printf( "FPE at 0x%x:\n", info->si_addr ); - - ret = fetestexcept( FE_ALL_EXCEPT ); - if ( ret & FE_INEXACT ) { - Sys_Printf( "FE_INEXACT " ); - } - if ( ret & FE_DIVBYZERO ) { - Sys_Printf( "FE_DIVBYZERO " ); - } - if ( ret & FE_UNDERFLOW ) { - Sys_Printf( "FE_UNDERFLOW " ); - } - if ( ret & FE_OVERFLOW ) { - Sys_Printf( "FE_OVERFLOW " ); - } - if ( ret & FE_INVALID ) { - Sys_Printf( "FE_INVALID " ); - } - Sys_Printf( "\n" ); - // clear the exception flags - feclearexcept( FE_ALL_EXCEPT ); - // re-arm - fs->fpscr &= exception_mask; - ss->srr0 += 4; -#endif -} - /* ================ Sys_GetSystemRam diff --git a/neo/sys/posix/posix_public.h b/neo/sys/posix/posix_public.h index 8ce6f080..bf1e6e10 100644 --- a/neo/sys/posix/posix_public.h +++ b/neo/sys/posix/posix_public.h @@ -50,7 +50,6 @@ void Posix_SetExitSpawn( const char *exeName ); // set the process to be spawne void Posix_InitConsoleInput( void ); void Posix_Shutdown( void ); -void Sys_FPE_handler( int signum, siginfo_t *info, void *context ); void Sys_DoStartProcess( const char *exeName, bool dofork = true ); // if not forking, current process gets replaced #endif diff --git a/neo/sys/posix/posix_signal.cpp b/neo/sys/posix/posix_signal.cpp index 6e19e993..2b06494f 100644 --- a/neo/sys/posix/posix_signal.cpp +++ b/neo/sys/posix/posix_signal.cpp @@ -42,7 +42,6 @@ const int siglist[] = { SIGTRAP, SIGIOT, SIGBUS, - SIGFPE, SIGSEGV, SIGPIPE, SIGABRT, @@ -58,7 +57,6 @@ const char *signames[] = { "SIGTRAP", "SIGIOT", "SIGBUS", - "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGABRT", @@ -138,13 +136,7 @@ void Posix_InitSigs( ) { i = 0; while ( siglist[ i ] != -1 ) { - if ( siglist[ i ] == SIGFPE ) { - action.sa_sigaction = Sys_FPE_handler; - if ( sigaction( siglist[ i ], &action, NULL ) != 0 ) { - Sys_Printf( "Failed to set SIGFPE handler: %s\n", strerror( errno ) ); - } - action.sa_sigaction = sig_handler; - } else if ( sigaction( siglist[ i ], &action, NULL ) != 0 ) { + if ( sigaction( siglist[ i ], &action, NULL ) != 0 ) { Sys_Printf( "Failed to set %s handler: %s\n", signames[ i ], strerror( errno ) ); } i++;