sighnd.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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); cdecl;
  24. var
  25. res : word;
  26. begin
  27. res:=0;
  28. case sig of
  29. SIGFPE :
  30. begin
  31. { don't know how to find the different causes, maybe via xer? }
  32. res := 207;
  33. case siginfo^.si_code of
  34. FPE_INTDIV:
  35. res:=200;
  36. FPE_INTOVF:
  37. res:=205;
  38. FPE_FLTDIV:
  39. res:=200;
  40. FPE_FLTOVF:
  41. res:=205;
  42. FPE_FLTUND:
  43. res:=206;
  44. FPE_FLTRES,
  45. FPE_FLTINV,
  46. FPE_FLTSUB:
  47. res:=216;
  48. else
  49. res:=207;
  50. end;
  51. end;
  52. SIGILL,
  53. SIGBUS,
  54. SIGSEGV :
  55. res:=216;
  56. end;
  57. { give runtime error at the position where the signal was raised }
  58. if res<>0 then
  59. HandleError(res);
  60. // HandleErrorAddrFrame(res,pointer(SigContext.uc.uc_mcontext.pt_regs^.nip),pointer(SigContext.uc.uc_mcontext.pt_regs^.gpr[1]));
  61. end;
  62. {
  63. $Log$
  64. Revision 1.4 2004-08-04 19:27:10 florian
  65. * fixed floating point and integer exception handling on sparc/linux
  66. Revision 1.3 2004/05/31 20:25:04 peter
  67. * removed warnings
  68. Revision 1.2 2003/11/06 16:28:52 peter
  69. * compile fix
  70. Revision 1.1 2003/11/06 16:22:01 peter
  71. * sparc
  72. Revision 1.1 2003/11/02 14:53:06 jonas
  73. + sighand and associated record definitions for ppc. Untested.
  74. Revision 1.2 2003/11/01 01:58:11 marco
  75. * more small fixes.
  76. Revision 1.1 2003/11/01 01:27:20 marco
  77. * initial version from 1.0.x branch
  78. }