memory_util.h 689 B

12345678910111213141516171819202122232425
  1. // Copyright 2013 Dolphin Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #ifndef _MEMORYUTIL_H
  5. #define _MEMORYUTIL_H
  6. #ifndef _WIN32
  7. #include <sys/mman.h>
  8. #endif
  9. #include <string>
  10. void* AllocateExecutableMemory(size_t size, bool low = true);
  11. void* AllocateMemoryPages(size_t size);
  12. void FreeMemoryPages(void* ptr, size_t size);
  13. void* AllocateAlignedMemory(size_t size,size_t alignment);
  14. void FreeAlignedMemory(void* ptr);
  15. void WriteProtectMemory(void* ptr, size_t size, bool executable = false);
  16. void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
  17. std::string MemUsage();
  18. inline int GetPageSize() { return 4096; }
  19. #endif