kern: SvcMapPhysicalMemoryUnsafe, SvcUnmapPhysicalMemoryUnsafe

This commit is contained in:
Michael Scire
2020-07-24 22:04:04 -07:00
committed by SciresM
parent 583899ede3
commit 840ab0785c
7 changed files with 135 additions and 6 deletions

View File

@@ -227,6 +227,7 @@ namespace ams::kern::arch::arm64 {
bool Contains(KProcessAddress addr, size_t size) const { return this->page_table.Contains(addr, size); }
bool IsInAliasRegion(KProcessAddress addr, size_t size) const { return this->page_table.IsInAliasRegion(addr, size); }
bool IsInUnsafeAliasRegion(KProcessAddress addr, size_t size) const { return this->page_table.IsInUnsafeAliasRegion(addr, size); }
bool CanContain(KProcessAddress addr, size_t size, KMemoryState state) const { return this->page_table.CanContain(addr, size, state); }

View File

@@ -184,6 +184,11 @@ namespace ams::kern {
return this->Contains(addr, size) && this->alias_region_start <= addr && addr + size - 1 <= this->alias_region_end - 1;
}
bool IsInUnsafeAliasRegion(KProcessAddress addr, size_t size) const {
/* Even though Unsafe physical memory is KMemoryState_Normal, it must be mapped inside the alias code region. */
return this->CanContain(addr, size, KMemoryState_AliasCode);
}
KProcessAddress GetRegionAddress(KMemoryState state) const;
size_t GetRegionSize(KMemoryState state) const;
bool CanContain(KProcessAddress addr, size_t size, KMemoryState state) const;

View File

@@ -153,6 +153,8 @@ namespace ams::kern {
constexpr KProcessAddress GetEntryPoint() const { return this->code_address; }
constexpr KMemoryManager::Pool GetMemoryPool() const { return this->memory_pool; }
constexpr u64 GetRandomEntropy(size_t i) const { return this->entropy[i]; }
constexpr bool IsApplication() const { return this->is_application; }

View File

@@ -62,6 +62,7 @@ namespace ams::kern::svc {
/* 131 */ using ::ams::svc::ResultPortClosed;
/* 132 */ using ::ams::svc::ResultLimitReached;
/* 133 */ using ::ams::svc::ResultInvalidMemoryPool;
/* 258 */ using ::ams::svc::ResultReceiveListBroken;
/* 259 */ using ::ams::svc::ResultOutOfAddressSpace;