sighnd.inc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. 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. HandleError(res);
  59. // HandleErrorAddrFrame(res,pointer(SigContext.uc.uc_mcontext.pt_regs^.nip),pointer(SigContext.uc.uc_mcontext.pt_regs^.gpr[1]));
  60. end;
  61. {
  62. $Log$
  63. Revision 1.5 2004-11-06 22:48:16 florian
  64. * fixed errno setting in mt sparc/linux mt programs
  65. Revision 1.4 2004/08/04 19:27:10 florian
  66. * fixed floating point and integer exception handling on sparc/linux
  67. Revision 1.3 2004/05/31 20:25:04 peter
  68. * removed warnings
  69. Revision 1.2 2003/11/06 16:28:52 peter
  70. * compile fix
  71. Revision 1.1 2003/11/06 16:22:01 peter
  72. * sparc
  73. Revision 1.1 2003/11/02 14:53:06 jonas
  74. + sighand and associated record definitions for ppc. Untested.
  75. Revision 1.2 2003/11/01 01:58:11 marco
  76. * more small fixes.
  77. Revision 1.1 2003/11/01 01:27:20 marco
  78. * initial version from 1.0.x branch
  79. }