sysheap.inc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2001 by Free Pascal development team
  4. This file implements all the base types and limits required
  5. for a minimal POSIX compliant subset required to port the compiler
  6. to a new OS.
  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. {*****************************************************************************
  14. Heap Management
  15. *****************************************************************************}
  16. function SysOSAlloc(size: ptruint): pointer;
  17. const
  18. page_size = 65536;
  19. err = high(longword);
  20. var
  21. res: ptruint;
  22. begin
  23. res:=fpc_wasm32_memory_grow((size + page_size - 1) div page_size);
  24. if res<>err then
  25. SysOSAlloc:=pointer(res*page_size)
  26. else
  27. SysOSAlloc:=nil;
  28. end;
  29. procedure SysOSFree(p: pointer; size: ptruint);
  30. begin
  31. end;