sighnd.inc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. Signalhandler for DragonFly
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY;without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. }
  12. procedure SignalToRunerror(Sig: cint; info : psiginfo; SigContext:PSigContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
  13. var
  14. res : word;
  15. begin
  16. res:=0;
  17. case sig of
  18. SIGFPE :
  19. begin
  20. Case Info^.si_code Of
  21. FPE_INTDIV : Res:=200; {integer divide fault. Div0?}
  22. FPE_FLTOVF : Res:=205; {Overflow trap}
  23. FPE_FLTUND : Res:=206; {Stack over/underflow}
  24. FPE_FLTRES : Res:=216; {Device not available}
  25. FPE_FLTINV : Res:=216; {Invalid floating point operation}
  26. Else
  27. Res:=208; {coprocessor error}
  28. End;
  29. sysResetFPU;
  30. End;
  31. SIGILL,
  32. SIGBUS,
  33. SIGSEGV :
  34. res:=216;
  35. SIGINT:
  36. res:=217;
  37. SIGQUIT:
  38. res:=233;
  39. end;
  40. {$ifdef FPC_USE_SIGPROCMASK}
  41. reenable_signal(sig);
  42. {$endif }
  43. { give runtime error at the position where the signal was raised }
  44. if res<>0 then
  45. begin
  46. HandleError(res);
  47. end;
  48. end;