riscv32.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. RiscV32
  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. { Common RiscV stuff }
  13. {$I ../riscv/riscv.inc}
  14. {$IFNDEF INTERNAL_BACKTRACE}
  15. {$define FPC_SYSTEM_HAS_GET_FRAME}
  16. function get_frame:pointer;assembler;nostackframe;
  17. asm
  18. end;
  19. {$ENDIF not INTERNAL_BACKTRACE}
  20. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  21. function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;assembler;
  22. asm
  23. end;
  24. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  25. function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;assembler;
  26. asm
  27. end;
  28. {$define FPC_SYSTEM_HAS_SPTR}
  29. Function Sptr : pointer;assembler;
  30. asm
  31. end;
  32. function InterLockedDecrement (var Target: longint) : longint;
  33. begin
  34. dec(Target);
  35. Result:=Target;
  36. end;
  37. function InterLockedIncrement (var Target: longint) : longint;
  38. begin
  39. inc(Target);
  40. Result:=Target;
  41. end;
  42. function InterLockedExchange (var Target: longint;Source : longint) : longint;
  43. begin
  44. Result:=Target;
  45. Target:=Source;
  46. end;
  47. function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint;
  48. begin
  49. Result:=Target;
  50. if Target=Comperand then
  51. Target:=NewValue;
  52. end;
  53. function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint;
  54. begin
  55. Result:=Target;
  56. inc(Target,Source);
  57. end;