1{ 2 This file is part of the Free Pascal run time library. 3 (c) 2000-2003 by Marco van de Voort 4 member of the Free Pascal development team. 5 6 See the file COPYING.FPC, included in this distribution, 7 for details about the copyright. 8 9 Signalhandler for FreeBSD/i386 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY;without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14} 15 16procedure SignalToRunerror(Sig: cint; info : psiginfo; SigContext:PSigContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl; 17 18var 19 res : word; 20 21begin 22 res:=0; 23 case sig of 24 SIGFPE : 25 begin 26 Case Info^.si_code Of 27 FPE_INTDIV : Res:=200; {integer divide fault. Div0?} 28 FPE_FLTOVF : Res:=205; {Overflow trap} 29 FPE_FLTUND : Res:=206; {Stack over/underflow} 30 FPE_FLTRES : Res:=216; {Device not available} 31 FPE_FLTINV : Res:=216; {Invalid floating point operation} 32 Else 33 Res:=208; {coprocessor error} 34 End; 35 sysResetFPU; 36 End; 37 SIGILL: 38 if sse_check then 39 begin 40 os_supports_sse:=false; 41 res:=0; 42 inc(sigcontext^.sc_eip,3); 43 end 44 else 45 res:=216; 46 SIGBUS: 47 res:=214; 48 SIGSEGV : 49 res:=216; 50 SIGINT: 51 res:=217; 52 SIGQUIT: 53 res:=233; 54 end; 55 {$ifdef FPC_USE_SIGPROCMASK} 56 reenable_signal(sig); 57 {$endif } 58{ give runtime error at the position where the signal was raised } 59 if res<>0 then 60 begin 61{$ifdef cpui386} 62 HandleErrorAddrFrame(res,Pointer(SigContext^.sc_eip),pointer(SigContext^.sc_ebp)); 63{$else} 64 HandleError(res); 65{$endif} 66 end; 67end; 68