memory_setup.h 985 B

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.h"
  7. namespace Memory {
  8. const u32 PAGE_MASK = PAGE_SIZE - 1;
  9. const int PAGE_BITS = 12;
  10. void InitMemoryMap();
  11. /**
  12. * Maps an allocated buffer onto a region of the emulated process address space.
  13. *
  14. * @param base The address to start mapping at. Must be page-aligned.
  15. * @param size The amount of bytes to map. Must be page-aligned.
  16. * @param target Buffer with the memory backing the mapping. Must be of length at least `size`.
  17. */
  18. void MapMemoryRegion(VAddr base, u32 size, u8* target);
  19. /**
  20. * Maps a region of the emulated process address space as a IO region.
  21. * @note Currently this can only be used to mark a region as being IO, since actual memory-mapped
  22. * IO isn't yet supported.
  23. */
  24. void MapIoRegion(VAddr base, u32 size);
  25. void UnmapRegion(VAddr base, u32 size);
  26. }