memory_setup.h 1.4 KB

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