mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 13:52:21 +00:00
kern: fix KCodeMemory SVCs when Owner process != Generator process
This commit is contained in:
parent
9b65daf439
commit
dbe59fd041
2 changed files with 4 additions and 4 deletions
|
@ -133,7 +133,7 @@ namespace ams::kern {
|
|||
}
|
||||
|
||||
/* Map the memory. */
|
||||
R_TRY(GetCurrentProcess().GetPageTable().MapPageGroup(address, GetReference(this->page_group), KMemoryState_GeneratedCode, k_perm));
|
||||
R_TRY(this->owner->GetPageTable().MapPageGroup(address, GetReference(this->page_group), KMemoryState_GeneratedCode, k_perm));
|
||||
|
||||
/* Mark ourselves as mapped. */
|
||||
this->is_owner_mapped = true;
|
||||
|
@ -151,7 +151,7 @@ namespace ams::kern {
|
|||
KScopedLightLock lk(this->lock);
|
||||
|
||||
/* Unmap the memory. */
|
||||
R_TRY(GetCurrentProcess().GetPageTable().UnmapPageGroup(address, GetReference(this->page_group), KMemoryState_GeneratedCode));
|
||||
R_TRY(this->owner->GetPageTable().UnmapPageGroup(address, GetReference(this->page_group), KMemoryState_GeneratedCode));
|
||||
|
||||
/* Mark ourselves as unmapped. */
|
||||
MESOSPHERE_ASSERT(this->is_owner_mapped);
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace ams::kern::svc {
|
|||
case ams::svc::CodeMemoryOperation_MapToOwner:
|
||||
{
|
||||
/* Check that the region is in range. */
|
||||
R_UNLESS(GetCurrentProcess().GetPageTable().CanContain(address, size, KMemoryState_GeneratedCode), svc::ResultInvalidMemoryRegion());
|
||||
R_UNLESS(code_mem->GetOwner()->GetPageTable().CanContain(address, size, KMemoryState_GeneratedCode), svc::ResultInvalidMemoryRegion());
|
||||
|
||||
/* Check the memory permission. */
|
||||
R_UNLESS(IsValidMapToOwnerCodeMemoryPermission(perm), svc::ResultInvalidNewMemoryPermission());
|
||||
|
@ -122,7 +122,7 @@ namespace ams::kern::svc {
|
|||
case ams::svc::CodeMemoryOperation_UnmapFromOwner:
|
||||
{
|
||||
/* Check that the region is in range. */
|
||||
R_UNLESS(GetCurrentProcess().GetPageTable().CanContain(address, size, KMemoryState_GeneratedCode), svc::ResultInvalidMemoryRegion());
|
||||
R_UNLESS(code_mem->GetOwner()->GetPageTable().CanContain(address, size, KMemoryState_GeneratedCode), svc::ResultInvalidMemoryRegion());
|
||||
|
||||
/* Check the memory permission. */
|
||||
R_UNLESS(IsValidUnmapFromOwnerCodeMemoryPermission(perm), svc::ResultInvalidNewMemoryPermission());
|
||||
|
|
Loading…
Reference in a new issue