memory_setup.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2015 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. #include "common/memory_hook.h"
  7. namespace Common {
  8. struct PageTable;
  9. }
  10. namespace Memory {
  11. /**
  12. * Maps an allocated buffer onto a region of the emulated process address space.
  13. *
  14. * @param page_table The page table of the emulated process.
  15. * @param base The address to start mapping at. Must be page-aligned.
  16. * @param size The amount of bytes to map. Must be page-aligned.
  17. * @param target Buffer with the memory backing the mapping. Must be of length at least `size`.
  18. */
  19. void MapMemoryRegion(Common::PageTable& page_table, VAddr base, u64 size, u8* target);
  20. /**
  21. * Maps a region of the emulated process address space as a IO region.
  22. * @param page_table The page table of the emulated process.
  23. * @param base The address to start mapping at. Must be page-aligned.
  24. * @param size The amount of bytes to map. Must be page-aligned.
  25. * @param mmio_handler The handler that backs the mapping.
  26. */
  27. void MapIoRegion(Common::PageTable& page_table, VAddr base, u64 size,
  28. Common::MemoryHookPointer mmio_handler);
  29. void UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size);
  30. void AddDebugHook(Common::PageTable& page_table, VAddr base, u64 size,
  31. Common::MemoryHookPointer hook);
  32. void RemoveDebugHook(Common::PageTable& page_table, VAddr base, u64 size,
  33. Common::MemoryHookPointer hook);
  34. } // namespace Memory