sighnd.inc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. procedure SignalToRunerror(Sig: longint; { _a2,_a3,_a4 : dword; } SigContext: PSigInfo; uContext : PuContext); public name '_FPC_DEFAULTSIGHANDLER'; cdecl;
  14. var
  15. res : word;
  16. begin
  17. res:=0;
  18. case sig of
  19. SIGFPE :
  20. begin
  21. { don't know how to find the different causes, maybe via xer? }
  22. res := 207;
  23. end;
  24. SIGILL:
  25. {$ifdef FPC_SYSTEM_FPC_MOVE}
  26. if in_edsp_test then
  27. begin
  28. res:=0;
  29. cpu_has_edsp:=false;
  30. inc(uContext^.uc_mcontext.arm_pc,4);
  31. end
  32. else
  33. {$endif FPC_SYSTEM_FPC_MOVE}
  34. res:=216;
  35. SIGSEGV :
  36. res:=216;
  37. SIGBUS:
  38. res:=214;
  39. SIGINT:
  40. res:=217;
  41. SIGQUIT:
  42. res:=233;
  43. end;
  44. reenable_signal(sig);
  45. { give runtime error at the position where the signal was raised }
  46. if res<>0 then
  47. HandleErrorAddrFrame(res,pointer(uContext^.uc_mcontext.arm_pc),pointer(uContext^.uc_mcontext.arm_fp));
  48. end;