mem_map.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_types.h"
  6. namespace Memory {
  7. extern u8* g_exefs_code; ///< ExeFS:/.code is loaded here
  8. extern u8* g_heap; ///< Application heap (main memory)
  9. extern u8* g_shared_mem; ///< Shared memory
  10. extern u8* g_heap_linear; ///< Linear heap (main memory)
  11. extern u8* g_vram; ///< Video memory (VRAM)
  12. extern u8* g_dsp_mem; ///< DSP memory
  13. extern u8* g_tls_mem; ///< TLS memory
  14. void Init();
  15. void Shutdown();
  16. /**
  17. * Maps a block of memory on the heap
  18. * @param size Size of block in bytes
  19. * @param operation Memory map operation type
  20. * @param permissions Memory allocation permissions
  21. */
  22. u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions);
  23. /**
  24. * Maps a block of memory on the GSP heap
  25. * @param size Size of block in bytes
  26. * @param operation Memory map operation type
  27. * @param permissions Control memory permissions
  28. */
  29. u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions);
  30. /**
  31. * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical
  32. * address. This should be used by services to translate addresses for use by the hardware.
  33. */
  34. PAddr VirtualToPhysicalAddress(VAddr addr);
  35. /**
  36. * Undoes a mapping performed by VirtualToPhysicalAddress().
  37. */
  38. VAddr PhysicalToVirtualAddress(PAddr addr);
  39. } // namespace