1999-11-12 02:00:34 +01:00
|
|
|
/*
|
|
|
|
* Sparc signal handling routines
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-11-12 02:00:34 +01:00
|
|
|
* Copyright 1999 Ulrich Weigand
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-11-12 02:00:34 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __sparc__
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-06-04 03:48:05 +02:00
|
|
|
#include <stdio.h>
|
1999-11-12 02:00:34 +01:00
|
|
|
#include <sys/ucontext.h>
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-11-12 02:00:34 +01:00
|
|
|
#include "winbase.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winreg.h"
|
|
|
|
#include "winternl.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
#include "winnt.h"
|
|
|
|
|
|
|
|
#include "wine/exception.h"
|
2003-06-30 23:00:15 +02:00
|
|
|
#include "ntdll_misc.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-11-12 02:00:34 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(seh);
|
1999-11-12 02:00:34 +01:00
|
|
|
|
2002-11-08 19:54:10 +01:00
|
|
|
#define HANDLER_DEF(name) void name( int __signal, struct siginfo *__siginfo, ucontext_t *__context )
|
|
|
|
#define HANDLER_CONTEXT (__context)
|
|
|
|
|
2002-08-09 03:07:29 +02:00
|
|
|
typedef int (*wine_signal_handler)(unsigned int sig);
|
2002-07-31 20:46:09 +02:00
|
|
|
|
|
|
|
static wine_signal_handler handlers[256];
|
|
|
|
|
2003-01-04 01:19:17 +01:00
|
|
|
extern void WINAPI EXC_RtlRaiseException( PEXCEPTION_RECORD, PCONTEXT );
|
2002-07-31 20:46:09 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* dispatch_signal
|
|
|
|
*/
|
2002-08-09 03:07:29 +02:00
|
|
|
inline static int dispatch_signal(unsigned int sig)
|
2002-07-31 20:46:09 +02:00
|
|
|
{
|
|
|
|
if (handlers[sig] == NULL) return 0;
|
|
|
|
return handlers[sig](sig);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-12 02:00:34 +01:00
|
|
|
/*
|
|
|
|
* FIXME: All this works only on Solaris for now
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* save_context
|
|
|
|
*/
|
|
|
|
static void save_context( CONTEXT *context, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
/* Special registers */
|
|
|
|
context->psr = ucontext->uc_mcontext.gregs[REG_PSR];
|
|
|
|
context->pc = ucontext->uc_mcontext.gregs[REG_PC];
|
|
|
|
context->npc = ucontext->uc_mcontext.gregs[REG_nPC];
|
|
|
|
context->y = ucontext->uc_mcontext.gregs[REG_Y];
|
|
|
|
context->wim = 0; /* FIXME */
|
|
|
|
context->tbr = 0; /* FIXME */
|
|
|
|
|
|
|
|
/* Global registers */
|
|
|
|
context->g0 = 0; /* always */
|
|
|
|
context->g1 = ucontext->uc_mcontext.gregs[REG_G1];
|
|
|
|
context->g2 = ucontext->uc_mcontext.gregs[REG_G2];
|
|
|
|
context->g3 = ucontext->uc_mcontext.gregs[REG_G3];
|
|
|
|
context->g4 = ucontext->uc_mcontext.gregs[REG_G4];
|
|
|
|
context->g5 = ucontext->uc_mcontext.gregs[REG_G5];
|
|
|
|
context->g6 = ucontext->uc_mcontext.gregs[REG_G6];
|
|
|
|
context->g7 = ucontext->uc_mcontext.gregs[REG_G7];
|
|
|
|
|
|
|
|
/* Current 'out' registers */
|
|
|
|
context->o0 = ucontext->uc_mcontext.gregs[REG_O0];
|
|
|
|
context->o1 = ucontext->uc_mcontext.gregs[REG_O1];
|
|
|
|
context->o2 = ucontext->uc_mcontext.gregs[REG_O2];
|
|
|
|
context->o3 = ucontext->uc_mcontext.gregs[REG_O3];
|
|
|
|
context->o4 = ucontext->uc_mcontext.gregs[REG_O4];
|
|
|
|
context->o5 = ucontext->uc_mcontext.gregs[REG_O5];
|
|
|
|
context->o6 = ucontext->uc_mcontext.gregs[REG_O6];
|
|
|
|
context->o7 = ucontext->uc_mcontext.gregs[REG_O7];
|
|
|
|
|
|
|
|
/* FIXME: what if the current register window isn't saved? */
|
|
|
|
if ( ucontext->uc_mcontext.gwins && ucontext->uc_mcontext.gwins->wbcnt > 0 )
|
|
|
|
{
|
|
|
|
/* Current 'local' registers from first register window */
|
|
|
|
context->l0 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[0];
|
|
|
|
context->l1 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[1];
|
|
|
|
context->l2 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[2];
|
|
|
|
context->l3 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[3];
|
|
|
|
context->l4 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[4];
|
|
|
|
context->l5 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[5];
|
|
|
|
context->l6 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[6];
|
|
|
|
context->l7 = ucontext->uc_mcontext.gwins->wbuf[0].rw_local[7];
|
|
|
|
|
|
|
|
/* Current 'in' registers from first register window */
|
|
|
|
context->i0 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[0];
|
|
|
|
context->i1 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[1];
|
|
|
|
context->i2 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[2];
|
|
|
|
context->i3 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[3];
|
|
|
|
context->i4 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[4];
|
|
|
|
context->i5 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[5];
|
|
|
|
context->i6 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[6];
|
|
|
|
context->i7 = ucontext->uc_mcontext.gwins->wbuf[0].rw_in[7];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* restore_context
|
|
|
|
*/
|
|
|
|
static void restore_context( CONTEXT *context, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
/* FIXME */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* save_fpu
|
|
|
|
*/
|
|
|
|
static void save_fpu( CONTEXT *context, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
/* FIXME */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* restore_fpu
|
|
|
|
*/
|
|
|
|
static void restore_fpu( CONTEXT *context, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
/* FIXME */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* segv_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGSEGV.
|
|
|
|
*/
|
|
|
|
static void segv_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
/* we want the page-fault case to be fast */
|
|
|
|
if ( info->si_code == SEGV_ACCERR )
|
|
|
|
if (VIRTUAL_HandleFault( (LPVOID)info->si_addr )) return;
|
|
|
|
|
|
|
|
save_context( &context, ucontext );
|
|
|
|
rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 2;
|
|
|
|
rec.ExceptionInformation[0] = 0; /* FIXME: read/write access ? */
|
|
|
|
rec.ExceptionInformation[1] = (DWORD)info->si_addr;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-14 00:54:04 +01:00
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
1999-11-12 02:00:34 +01:00
|
|
|
restore_context( &context, ucontext );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* bus_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGBUS.
|
|
|
|
*/
|
|
|
|
static void bus_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
save_context( &context, ucontext );
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 0;
|
|
|
|
|
|
|
|
if ( info->si_code == BUS_ADRALN )
|
|
|
|
rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT;
|
|
|
|
else
|
|
|
|
rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-14 00:54:04 +01:00
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
1999-11-12 02:00:34 +01:00
|
|
|
restore_context( &context, ucontext );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ill_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGILL.
|
|
|
|
*/
|
|
|
|
static void ill_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
switch ( info->si_code )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case ILL_ILLOPC:
|
|
|
|
case ILL_ILLOPN:
|
|
|
|
case ILL_ILLADR:
|
|
|
|
case ILL_ILLTRP:
|
|
|
|
rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ILL_PRVOPC:
|
|
|
|
case ILL_PRVREG:
|
|
|
|
rec.ExceptionCode = EXCEPTION_PRIV_INSTRUCTION;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ILL_BADSTK:
|
|
|
|
rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW;
|
|
|
|
break;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-11-12 02:00:34 +01:00
|
|
|
save_context( &context, ucontext );
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 0;
|
1999-11-14 00:54:04 +01:00
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
1999-11-12 02:00:34 +01:00
|
|
|
restore_context( &context, ucontext );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* trap_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGTRAP.
|
|
|
|
*/
|
|
|
|
static void trap_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
switch ( info->si_code )
|
|
|
|
{
|
|
|
|
case TRAP_TRACE:
|
|
|
|
rec.ExceptionCode = EXCEPTION_SINGLE_STEP;
|
|
|
|
break;
|
|
|
|
case TRAP_BRKPT:
|
|
|
|
default:
|
|
|
|
rec.ExceptionCode = EXCEPTION_BREAKPOINT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
save_context( &context, ucontext );
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 0;
|
1999-11-14 00:54:04 +01:00
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
1999-11-12 02:00:34 +01:00
|
|
|
restore_context( &context, ucontext );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* fpe_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGFPE.
|
|
|
|
*/
|
|
|
|
static void fpe_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
switch ( info->si_code )
|
|
|
|
{
|
|
|
|
case FPE_FLTSUB:
|
|
|
|
rec.ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED;
|
|
|
|
break;
|
|
|
|
case FPE_INTDIV:
|
|
|
|
rec.ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO;
|
|
|
|
break;
|
|
|
|
case FPE_INTOVF:
|
|
|
|
rec.ExceptionCode = EXCEPTION_INT_OVERFLOW;
|
|
|
|
break;
|
|
|
|
case FPE_FLTDIV:
|
|
|
|
rec.ExceptionCode = EXCEPTION_FLT_DIVIDE_BY_ZERO;
|
|
|
|
break;
|
|
|
|
case FPE_FLTOVF:
|
|
|
|
rec.ExceptionCode = EXCEPTION_FLT_OVERFLOW;
|
|
|
|
break;
|
|
|
|
case FPE_FLTUND:
|
|
|
|
rec.ExceptionCode = EXCEPTION_FLT_UNDERFLOW;
|
|
|
|
break;
|
|
|
|
case FPE_FLTRES:
|
|
|
|
rec.ExceptionCode = EXCEPTION_FLT_INEXACT_RESULT;
|
|
|
|
break;
|
|
|
|
case FPE_FLTINV:
|
|
|
|
default:
|
|
|
|
rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
save_context( &context, ucontext );
|
|
|
|
save_fpu( &context, ucontext );
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 0;
|
1999-11-14 00:54:04 +01:00
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
1999-11-12 02:00:34 +01:00
|
|
|
restore_context( &context, ucontext );
|
|
|
|
restore_fpu( &context, ucontext );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* int_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGINT.
|
|
|
|
*/
|
|
|
|
static void int_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
|
|
|
|
{
|
2002-07-31 20:46:09 +02:00
|
|
|
if (!dispatch_signal(SIGINT))
|
2002-06-02 23:22:22 +02:00
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
save_context( &context, ucontext );
|
|
|
|
rec.ExceptionCode = CONTROL_C_EXIT;
|
|
|
|
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
|
|
|
rec.NumberParameters = 0;
|
|
|
|
EXC_RtlRaiseException( &rec, &context );
|
|
|
|
restore_context( &context, ucontext );
|
|
|
|
}
|
1999-11-12 02:00:34 +01:00
|
|
|
}
|
|
|
|
|
2002-10-29 00:56:58 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* abrt_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGABRT.
|
|
|
|
*/
|
|
|
|
static HANDLER_DEF(abrt_handler)
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
CONTEXT context;
|
|
|
|
|
|
|
|
save_context( &context, HANDLER_CONTEXT );
|
|
|
|
rec.ExceptionCode = EXCEPTION_WINE_ASSERTION;
|
|
|
|
rec.ExceptionFlags = EH_NONCONTINUABLE;
|
|
|
|
rec.ExceptionRecord = NULL;
|
2002-11-08 19:54:10 +01:00
|
|
|
rec.ExceptionAddress = (LPVOID)context.pc;
|
2002-10-29 00:56:58 +01:00
|
|
|
rec.NumberParameters = 0;
|
|
|
|
EXC_RtlRaiseException( &rec, &context ); /* Should never return.. */
|
|
|
|
restore_context( &context, HANDLER_CONTEXT );
|
|
|
|
}
|
1999-11-12 02:00:34 +01:00
|
|
|
|
2003-03-04 23:18:43 +01:00
|
|
|
|
2003-03-22 00:45:26 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* term_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGTERM.
|
|
|
|
*/
|
|
|
|
static HANDLER_DEF(term_handler)
|
|
|
|
{
|
2003-11-06 01:08:05 +01:00
|
|
|
server_abort_thread(0);
|
2003-03-22 00:45:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-04 23:18:43 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* usr1_handler
|
|
|
|
*
|
|
|
|
* Handler for SIGUSR1, used to signal a thread that it got suspended.
|
|
|
|
*/
|
|
|
|
static HANDLER_DEF(usr1_handler)
|
|
|
|
{
|
2003-04-04 01:57:11 +02:00
|
|
|
LARGE_INTEGER timeout;
|
|
|
|
|
2003-03-04 23:18:43 +01:00
|
|
|
/* wait with 0 timeout, will only return once the thread is no longer suspended */
|
2003-04-04 01:57:11 +02:00
|
|
|
timeout.QuadPart = 0;
|
2003-06-30 23:00:15 +02:00
|
|
|
NTDLL_wait_for_multiple_objects( 0, NULL, 0, &timeout );
|
2003-03-04 23:18:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-12 02:00:34 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* set_handler
|
|
|
|
*
|
|
|
|
* Set a signal handler
|
|
|
|
*/
|
|
|
|
static int set_handler( int sig, void (*func)() )
|
|
|
|
{
|
|
|
|
struct sigaction sig_act;
|
|
|
|
|
|
|
|
sig_act.sa_handler = NULL;
|
|
|
|
sig_act.sa_sigaction = func;
|
|
|
|
sigemptyset( &sig_act.sa_mask );
|
|
|
|
sig_act.sa_flags = SA_SIGINFO;
|
|
|
|
|
|
|
|
return sigaction( sig, &sig_act, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-31 20:46:09 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* __wine_set_signal_handler (NTDLL.@)
|
|
|
|
*/
|
2002-08-09 03:07:29 +02:00
|
|
|
int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
|
2002-07-31 20:46:09 +02:00
|
|
|
{
|
|
|
|
if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1;
|
|
|
|
if (handlers[sig] != NULL) return -2;
|
|
|
|
handlers[sig] = wsh;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-12 02:00:34 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* SIGNAL_Init
|
|
|
|
*/
|
|
|
|
BOOL SIGNAL_Init(void)
|
|
|
|
{
|
|
|
|
if (set_handler( SIGINT, (void (*)())int_handler ) == -1) goto error;
|
|
|
|
if (set_handler( SIGFPE, (void (*)())fpe_handler ) == -1) goto error;
|
|
|
|
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
|
|
|
if (set_handler( SIGILL, (void (*)())ill_handler ) == -1) goto error;
|
|
|
|
if (set_handler( SIGBUS, (void (*)())bus_handler ) == -1) goto error;
|
|
|
|
if (set_handler( SIGTRAP, (void (*)())trap_handler ) == -1) goto error;
|
2002-10-29 00:56:58 +01:00
|
|
|
if (set_handler( SIGABRT, (void (*)())abrt_handler ) == -1) goto error;
|
2003-03-22 00:45:26 +01:00
|
|
|
if (set_handler( SIGTERM, (void (*)())term_handler ) == -1) goto error;
|
2003-03-04 23:18:43 +01:00
|
|
|
if (set_handler( SIGUSR1, (void (*)())usr1_handler ) == -1) goto error;
|
2004-11-21 16:38:26 +01:00
|
|
|
/* 'ta 6' tells the kernel to synthesize any unaligned accesses this
|
|
|
|
process makes, instead of just signalling an error and terminating
|
|
|
|
the process. wine-devel did not reach a conclusion on whether
|
|
|
|
this is correct, because that is what x86 does, or it is harmful
|
|
|
|
because it could obscure problems in user code */
|
|
|
|
asm("ta 6"); /* 6 == ST_FIX_ALIGN defined in sys/trap.h */
|
2002-10-29 00:56:58 +01:00
|
|
|
return TRUE;
|
1999-11-12 02:00:34 +01:00
|
|
|
|
|
|
|
error:
|
|
|
|
perror("sigaction");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-01-07 19:02:35 +01:00
|
|
|
|
2000-09-24 05:11:54 +02:00
|
|
|
/**********************************************************************
|
|
|
|
* __wine_enter_vm86
|
|
|
|
*/
|
|
|
|
void __wine_enter_vm86( CONTEXT *context )
|
|
|
|
{
|
|
|
|
MESSAGE("vm86 mode not supported on this platform\n");
|
|
|
|
}
|
|
|
|
|
2000-06-04 03:48:05 +02:00
|
|
|
/**********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* DbgBreakPoint (NTDLL.@)
|
2000-06-04 03:48:05 +02:00
|
|
|
*/
|
|
|
|
void WINAPI DbgBreakPoint(void)
|
|
|
|
{
|
2002-06-21 22:10:07 +02:00
|
|
|
kill(getpid(), SIGTRAP);
|
2000-06-04 03:48:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* DbgUserBreakPoint (NTDLL.@)
|
2000-06-04 03:48:05 +02:00
|
|
|
*/
|
|
|
|
void WINAPI DbgUserBreakPoint(void)
|
|
|
|
{
|
2002-06-21 22:10:07 +02:00
|
|
|
kill(getpid(), SIGTRAP);
|
2000-06-04 03:48:05 +02:00
|
|
|
}
|
|
|
|
|
1999-11-12 02:00:34 +01:00
|
|
|
#endif /* __sparc__ */
|