sighnd.inc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by Michael Van Canneyt,
  4. member of the Free Pascal development team.
  5. Signal handler is arch dependant due to processor to language
  6. exception conversion.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. function GetHandleErrorAddrFrameAddr: pointer;
  14. begin
  15. result:=@HandleErrorAddrFrame;
  16. end;
  17. Procedure SignalToHandleErrorAddrFrame(Errno : longint;addr : CodePointer; frame : Pointer); nostackframe; assembler;
  18. asm
  19. end;
  20. procedure SignalToRunerror(Sig: longint; { _a2,_a3,_a4 : dword; } SigContext: PSigInfo; uContext : PuContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
  21. var
  22. res : word;
  23. begin
  24. res:=0;
  25. case sig of
  26. SIGFPE :
  27. begin
  28. res := 207;
  29. SysResetFPU;
  30. end;
  31. SIGILL:
  32. res:=216;
  33. SIGSEGV :
  34. res:=216;
  35. SIGBUS:
  36. res:=214;
  37. SIGINT:
  38. res:=217;
  39. SIGQUIT:
  40. res:=233;
  41. end;
  42. { give runtime error at the position where the signal was raised }
  43. if res<>0 then
  44. begin
  45. {!!! ucontext^.uc_mcontext.arm_r0:=res;
  46. ucontext^.uc_mcontext.arm_r1:=uContext^.uc_mcontext.arm_pc;
  47. ucontext^.uc_mcontext.arm_r2:=uContext^.uc_mcontext.arm_fp;
  48. ucontext^.uc_mcontext.arm_pc:=ptruint(@SignalToHandleErrorAddrFrame); }
  49. end;
  50. end;