Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. //========== Copyright (C) Valve Corporation, All rights reserved. ==========//
  2. //
  3. // Purpose: CVirtualMemoryManager interface
  4. //
  5. //===========================================================================//
  6. #ifndef MEM_VIRT_H
  7. #define MEM_VIRT_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #define VMM_KB ( 1024 )
  12. #define VMM_MB ( 1024 * VMM_KB )
  13. #ifdef _PS3
  14. // Total virtual address space reserved by CVirtualMemoryManager on startup:
  15. #define VMM_VIRTUAL_SIZE ( 512 * VMM_MB )
  16. #define VMM_PAGE_SIZE ( 64 * VMM_KB )
  17. #endif
  18. // Allocate virtual sections via IMemAlloc::AllocateVirtualMemorySection
  19. abstract_class IVirtualMemorySection
  20. {
  21. public:
  22. // Information about memory section
  23. virtual void * GetBaseAddress() = 0;
  24. virtual size_t GetPageSize() = 0;
  25. virtual size_t GetTotalSize() = 0;
  26. // Functions to manage physical memory mapped to virtual memory
  27. virtual bool CommitPages( void *pvBase, size_t numBytes ) = 0;
  28. virtual void DecommitPages( void *pvBase, size_t numBytes ) = 0;
  29. // Release the physical memory and associated virtual address space
  30. virtual void Release() = 0;
  31. };
  32. // Get the IVirtualMemorySection associated with a given memory address (if any):
  33. extern IVirtualMemorySection *GetMemorySectionForAddress( void *pAddress );
  34. #endif // MEM_VIRT_H