sighnd.inc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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,fpustate : 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. if in_edsp_test then
  26. begin
  27. res:=0;
  28. cpu_has_edsp:=false;
  29. inc(uContext^.uc_mcontext.arm_pc,4);
  30. end
  31. else
  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. reenable_signal(sig);
  43. { give runtime error at the position where the signal was raised }
  44. if res<>0 then
  45. HandleErrorAddrFrame(res,pointer(uContext^.uc_mcontext.arm_pc),pointer(uContext^.uc_mcontext.arm_fp));
  46. end;