2014-04-09 04:45:46 +05:30
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 11:08:14 +05:30
|
|
|
// Licensed under GPLv2 or any later version
|
2014-04-09 04:45:46 +05:30
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2013-09-06 04:03:46 +05:30
|
|
|
|
2014-04-09 05:45:08 +05:30
|
|
|
#include "common/common_types.h"
|
2013-09-06 04:03:46 +05:30
|
|
|
|
2015-07-10 07:22:15 +05:30
|
|
|
namespace Kernel {
|
|
|
|
class VMManager;
|
|
|
|
}
|
|
|
|
|
2015-01-11 09:26:28 +05:30
|
|
|
namespace Memory {
|
2014-08-28 23:50:55 +05:30
|
|
|
|
2013-09-06 04:03:46 +05:30
|
|
|
void Init();
|
2015-07-10 07:22:15 +05:30
|
|
|
void InitLegacyAddressSpace(Kernel::VMManager& address_space);
|
2013-09-06 04:03:46 +05:30
|
|
|
void Shutdown();
|
|
|
|
|
2014-04-25 08:02:26 +05:30
|
|
|
/**
|
|
|
|
* Maps a block of memory on the heap
|
|
|
|
* @param size Size of block in bytes
|
|
|
|
* @param operation Memory map operation type
|
2014-11-18 19:01:24 +05:30
|
|
|
* @param permissions Memory allocation permissions
|
2014-04-25 08:02:26 +05:30
|
|
|
*/
|
|
|
|
u32 MapBlock_Heap(u32 size, u32 operation, u32 permissions);
|
|
|
|
|
2014-04-18 08:35:31 +05:30
|
|
|
/**
|
|
|
|
* Maps a block of memory on the GSP heap
|
|
|
|
* @param size Size of block in bytes
|
2014-04-25 08:02:26 +05:30
|
|
|
* @param operation Memory map operation type
|
2014-04-18 08:35:31 +05:30
|
|
|
* @param permissions Control memory permissions
|
|
|
|
*/
|
2014-11-23 09:05:45 +05:30
|
|
|
u32 MapBlock_HeapLinear(u32 size, u32 operation, u32 permissions);
|
2014-04-18 08:35:31 +05:30
|
|
|
|
2015-05-09 11:38:11 +05:30
|
|
|
/**
|
|
|
|
* Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical
|
|
|
|
* address. This should be used by services to translate addresses for use by the hardware.
|
|
|
|
*/
|
2014-08-28 23:50:55 +05:30
|
|
|
PAddr VirtualToPhysicalAddress(VAddr addr);
|
2014-04-27 22:10:31 +05:30
|
|
|
|
2015-05-09 11:38:11 +05:30
|
|
|
/**
|
|
|
|
* Undoes a mapping performed by VirtualToPhysicalAddress().
|
|
|
|
*/
|
|
|
|
VAddr PhysicalToVirtualAddress(PAddr addr);
|
|
|
|
|
2013-09-06 04:03:46 +05:30
|
|
|
} // namespace
|