sighnd.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. Signal handler is arch dependant due to processor to language
  7. exception conversion.
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. const
  15. FPE_INTDIV = 1;
  16. FPE_INTOVF = 2;
  17. FPE_FLTDIV = 3;
  18. FPE_FLTOVF = 4;
  19. FPE_FLTUND = 5;
  20. FPE_FLTRES = 6;
  21. FPE_FLTINV = 7;
  22. FPE_FLTSUB = 8;
  23. procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);cdecl;
  24. var
  25. res : word;
  26. begin
  27. res:=0;
  28. case sig of
  29. SIGFPE :
  30. begin
  31. res := 207;
  32. case siginfo^.si_code of
  33. FPE_INTDIV:
  34. res:=200;
  35. FPE_INTOVF:
  36. res:=205;
  37. FPE_FLTDIV:
  38. res:=200;
  39. FPE_FLTOVF:
  40. res:=205;
  41. FPE_FLTUND:
  42. res:=206;
  43. FPE_FLTRES,
  44. FPE_FLTINV,
  45. FPE_FLTSUB:
  46. res:=216;
  47. else
  48. res:=207;
  49. end;
  50. end;
  51. SIGILL,
  52. SIGBUS,
  53. SIGSEGV :
  54. res:=216;
  55. end;
  56. { give runtime error at the position where the signal was raised }
  57. if res<>0 then
  58. HandleErrorAddrFrame(res,pointer(SigContext^.sigc_pc),pointer(SigContext^.sigc_wbuf[SigContext^.sigc_oswins-1].ins[6]));
  59. end;
  60. {
  61. $Log$
  62. Revision 1.6 2005-01-30 18:01:15 peter
  63. * signal cleanup for linux
  64. * sigactionhandler instead of tsigaction for bsds
  65. * sigcontext moved to cpu dir
  66. Revision 1.5 2004/11/06 22:48:16 florian
  67. * fixed errno setting in mt sparc/linux mt programs
  68. Revision 1.4 2004/08/04 19:27:10 florian
  69. * fixed floating point and integer exception handling on sparc/linux
  70. Revision 1.3 2004/05/31 20:25:04 peter
  71. * removed warnings
  72. Revision 1.2 2003/11/06 16:28:52 peter
  73. * compile fix
  74. Revision 1.1 2003/11/06 16:22:01 peter
  75. * sparc
  76. Revision 1.1 2003/11/02 14:53:06 jonas
  77. + sighand and associated record definitions for ppc. Untested.
  78. Revision 1.2 2003/11/01 01:58:11 marco
  79. * more small fixes.
  80. Revision 1.1 2003/11/01 01:27:20 marco
  81. * initial version from 1.0.x branch
  82. }