spc32.inc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2008 by the Free Pascal development team.
  4. Processor dependent implementation for the system unit for
  5. AVR
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$if not(defined(FPUSOFT))}
  13. Procedure SysInitFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
  14. begin
  15. end;
  16. {$endif}
  17. procedure fpc_cpuinit;
  18. begin
  19. SysInitFPU;
  20. end;
  21. {$IFNDEF INTERNAL_BACKTRACE}
  22. {$define FPC_SYSTEM_HAS_GET_FRAME}
  23. function get_frame:pointer;assembler;nostackframe;
  24. asm
  25. ld r5
  26. st r0
  27. end;
  28. {$ENDIF not INTERNAL_BACKTRACE}
  29. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  30. function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;assembler;
  31. asm
  32. end;
  33. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  34. function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;assembler;
  35. asm
  36. end;
  37. {$define FPC_SYSTEM_HAS_SPTR}
  38. Function Sptr : pointer;assembler;
  39. asm
  40. ld r6
  41. st r0
  42. end;
  43. function InterLockedDecrement (var Target: longint) : longint; assembler; nostackframe;
  44. asm
  45. ld r0
  46. inc -1
  47. st r0
  48. end;
  49. function InterLockedIncrement (var Target: longint) : longint; assembler; nostackframe;
  50. asm
  51. ld r0
  52. inc 1
  53. st r0
  54. end;
  55. function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler; nostackframe;
  56. asm
  57. ld r0
  58. xchg r1
  59. st r0
  60. end;
  61. function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint; assembler; nostackframe;
  62. asm
  63. ld r0
  64. cas r2, r1
  65. st r0
  66. end;
  67. function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
  68. asm
  69. ld r0
  70. inc r1
  71. sub r1
  72. st r0
  73. end;