Memory: move memory setup into MemorySystem

This commit is contained in:
Weiyi Wang 2018-12-10 22:01:09 -05:00
parent e7a3c296c3
commit 643b7d4dcb
11 changed files with 46 additions and 56 deletions

View file

@ -214,6 +214,27 @@ public:
MemorySystem();
~MemorySystem();
/**
* Maps an allocated buffer onto a region of the emulated process address space.
*
* @param page_table The page table of the emulated process.
* @param base The address to start mapping at. Must be page-aligned.
* @param size The amount of bytes to map. Must be page-aligned.
* @param target Buffer with the memory backing the mapping. Must be of length at least `size`.
*/
void MapMemoryRegion(PageTable& page_table, VAddr base, u32 size, u8* target);
/**
* Maps a region of the emulated process address space as a IO region.
* @param page_table The page table of the emulated process.
* @param base The address to start mapping at. Must be page-aligned.
* @param size The amount of bytes to map. Must be page-aligned.
* @param mmio_handler The handler that backs the mapping.
*/
void MapIoRegion(PageTable& page_table, VAddr base, u32 size, MMIORegionPointer mmio_handler);
void UnmapRegion(PageTable& page_table, VAddr base, u32 size);
/// Currently active page table
void SetCurrentPageTable(PageTable* page_table);
PageTable* GetCurrentPageTable() const;
@ -275,6 +296,8 @@ private:
*/
u8* GetPointerForRasterizerCache(VAddr addr);
void MapPages(PageTable& page_table, u32 base, u32 size, u8* memory, PageType type);
class Impl;
std::unique_ptr<Impl> impl;