Refactor the memory implementation and add Regions

This commit does a major refactor of the memory implementation, it forms a memory map which is far cleaner than trying to access it through a handle table lookup. In addition, it creates a common interface for all memory kernel objects: KMemory from which all other kernel memory objects inherit. This allows doing resizing, permission change, etc without casting to the base memory type.
This commit is contained in:
◱ PixelyIon
2020-01-21 12:46:57 +05:30
committed by ◱ PixelyIon
parent b13002f0e1
commit 00cdc1fd6f
30 changed files with 1273 additions and 632 deletions

View File

@ -37,7 +37,7 @@ namespace skyline {
};
namespace kernel::svc {
/**
* @brief Set the process heap to a given size (https://switchbrew.org/wiki/SVC#svcSetHeapSize)
* @brief Sets the process heap to a given Size. It can both extend and shrink the heap. (https://switchbrew.org/wiki/SVC#svcSetHeapSize)
*/
void SetHeapSize(DeviceState &state);
@ -46,6 +46,11 @@ namespace skyline {
*/
void SetMemoryAttribute(DeviceState &state);
/**
* @brief Maps a memory range into a different range. Mainly used for adding guard pages around stack. (https://switchbrew.org/wiki/SVC#svcSetMemoryAttribute)
*/
void MapMemory(DeviceState &state);
/**
* @brief Query information about an address (https://switchbrew.org/wiki/SVC#svcQueryMemory)
*/
@ -169,7 +174,7 @@ namespace skyline {
SetHeapSize, // 0x01
nullptr, // 0x02
SetMemoryAttribute, // 0x03
nullptr, // 0x04
MapMemory, // 0x04
nullptr, // 0x05
QueryMemory, // 0x06
ExitProcess, // 0x07