2015-05-12 19:38:56 -07:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
2018-01-27 07:16:39 -08:00
|
|
|
#include "core/memory_hook.h"
|
2015-05-20 20:37:07 -07:00
|
|
|
|
2015-05-12 19:38:56 -07:00
|
|
|
namespace Memory {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps an allocated buffer onto a region of the emulated process address space.
|
|
|
|
*
|
2017-07-21 19:17:57 -07:00
|
|
|
* @param page_table The page table of the emulated process.
|
2015-05-12 19:38:56 -07:00
|
|
|
* @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`.
|
|
|
|
*/
|
2018-01-01 12:40:35 -08:00
|
|
|
void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target);
|
2015-05-12 19:38:56 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps a region of the emulated process address space as a IO region.
|
2017-07-21 19:17:57 -07:00
|
|
|
* @param page_table The page table of the emulated process.
|
2016-01-30 10:41:04 -08:00
|
|
|
* @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.
|
2015-05-12 19:38:56 -07:00
|
|
|
*/
|
2018-01-27 07:16:39 -08:00
|
|
|
void MapIoRegion(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer mmio_handler);
|
2015-05-12 19:38:56 -07:00
|
|
|
|
2018-01-01 12:40:35 -08:00
|
|
|
void UnmapRegion(PageTable& page_table, VAddr base, u64 size);
|
2018-01-27 07:16:39 -08:00
|
|
|
|
|
|
|
void AddDebugHook(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer hook);
|
|
|
|
void RemoveDebugHook(PageTable& page_table, VAddr base, u64 size, MemoryHookPointer hook);
|
|
|
|
|
2018-01-19 23:48:02 -08:00
|
|
|
} // namespace Memory
|