wasm32.inc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2017 by the Free Pascal development team.
  4. Processor dependent implementation for the system unit for
  5. WebAssembly 32-bit
  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. procedure fpc_cpuinit;
  13. begin
  14. end;
  15. {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
  16. function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;
  17. begin
  18. result:=nil;
  19. end;
  20. {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
  21. function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;
  22. begin
  23. result:=nil;
  24. end;
  25. {$define FPC_SYSTEM_HAS_SPTR}
  26. function Sptr : pointer;
  27. begin
  28. result:=nil;
  29. end;
  30. function InterLockedDecrement (var Target: longint) : longint;
  31. begin
  32. dec(Target);
  33. Result:=Target;
  34. end;
  35. function InterLockedIncrement (var Target: longint) : longint;
  36. begin
  37. inc(Target);
  38. Result:=Target;
  39. end;
  40. function InterLockedExchange (var Target: longint;Source : longint) : longint;
  41. begin
  42. Result:=Target;
  43. Target:=Source;
  44. end;
  45. function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint;
  46. begin
  47. Result:=Target;
  48. if Target=Comperand then
  49. Target:=NewValue;
  50. end;
  51. function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint;
  52. begin
  53. Result:=Target;
  54. inc(Target,Source);
  55. end;
  56. function InterLockedDecrement (var Target: smallint) : smallint;
  57. begin
  58. dec(Target);
  59. Result:=Target;
  60. end;
  61. function InterLockedIncrement (var Target: smallint) : smallint;
  62. begin
  63. inc(Target);
  64. Result:=Target;
  65. end;
  66. function InterLockedExchange (var Target: smallint;Source : smallint) : smallint;
  67. begin
  68. Result:=Target;
  69. Target:=Source;
  70. end;
  71. function InterlockedCompareExchange(var Target: smallint; NewValue: smallint; Comperand: smallint): smallint;
  72. begin
  73. Result:=Target;
  74. if Target=Comperand then
  75. Target:=NewValue;
  76. end;
  77. function InterLockedExchangeAdd (var Target: smallint;Source : smallint) : smallint;
  78. begin
  79. Result:=Target;
  80. inc(Target,Source);
  81. end;
  82. {$if defined(FPC_WASM_NATIVE_EXCEPTIONS)}
  83. {$I except_native.inc}
  84. {$endif}