Compare commits

...

10 commits

3 changed files with 9 additions and 8 deletions

View file

@ -175,8 +175,9 @@ constexpr KMemoryPermission ConvertToKMemoryPermission(Svc::MemoryPermission per
return static_cast<KMemoryPermission>( return static_cast<KMemoryPermission>(
(static_cast<KMemoryPermission>(perm) & KMemoryPermission::UserMask) | (static_cast<KMemoryPermission>(perm) & KMemoryPermission::UserMask) |
KMemoryPermission::KernelRead | KMemoryPermission::KernelRead |
((static_cast<KMemoryPermission>(perm) & KMemoryPermission::UserWrite) ((static_cast<KMemoryPermission>(perm) & Svc::MemoryPermission::UserWrite)
<< KMemoryPermission::KernelShift) | ? KMemoryPermission::KernelWrite
: KMemoryPermission::None) |
(perm == Svc::MemoryPermission::None ? KMemoryPermission::NotMapped (perm == Svc::MemoryPermission::None ? KMemoryPermission::NotMapped
: KMemoryPermission::None)); : KMemoryPermission::None));
} }

View file

@ -1594,7 +1594,7 @@ size_t KPageTableBase::GetAliasCodeDataSize() const {
} }
Result KPageTableBase::AllocateAndMapPagesImpl(PageLinkedList* page_list, KProcessAddress address, Result KPageTableBase::AllocateAndMapPagesImpl(PageLinkedList* page_list, KProcessAddress address,
size_t num_pages, KMemoryPermission perm) { size_t num_pages, KPageProperties& perm) {
ASSERT(this->IsLockedByCurrentThread()); ASSERT(this->IsLockedByCurrentThread());
// Create a page group to hold the pages we allocate. // Create a page group to hold the pages we allocate.
@ -1615,7 +1615,6 @@ Result KPageTableBase::AllocateAndMapPagesImpl(PageLinkedList* page_list, KProce
} }
// Map the pages. // Map the pages.
const KPageProperties properties = {perm, false, false, DisableMergeAttribute::None};
R_RETURN(this->Operate(page_list, address, num_pages, pg, properties, OperationType::MapGroup, R_RETURN(this->Operate(page_list, address, num_pages, pg, properties, OperationType::MapGroup,
false)); false));
} }
@ -2749,12 +2748,12 @@ Result KPageTableBase::MapPages(KProcessAddress* out_addr, size_t num_pages, siz
KScopedPageTableUpdater updater(this); KScopedPageTableUpdater updater(this);
// Perform mapping operation. // Perform mapping operation.
KPageProperties properties = {perm, false, false, DisableMergeAttribute::DisableHead};
if (is_pa_valid) { if (is_pa_valid) {
const KPageProperties properties = {perm, false, false, DisableMergeAttribute::DisableHead};
R_TRY(this->Operate(updater.GetPageList(), addr, num_pages, phys_addr, true, properties, R_TRY(this->Operate(updater.GetPageList(), addr, num_pages, phys_addr, true, properties,
OperationType::Map, false)); OperationType::Map, false));
} else { } else {
R_TRY(this->AllocateAndMapPagesImpl(updater.GetPageList(), addr, num_pages, perm)); R_TRY(this->AllocateAndMapPagesImpl(updater.GetPageList(), addr, num_pages, properties));
} }
// Update the blocks. // Update the blocks.
@ -2793,7 +2792,8 @@ Result KPageTableBase::MapPages(KProcessAddress address, size_t num_pages, KMemo
KScopedPageTableUpdater updater(this); KScopedPageTableUpdater updater(this);
// Map the pages. // Map the pages.
R_TRY(this->AllocateAndMapPagesImpl(updater.GetPageList(), address, num_pages, perm)); KPageProperties properties = {perm, false, false, DisableMergeAttribute::DisableHead};
R_TRY(this->AllocateAndMapPagesImpl(updater.GetPageList(), address, num_pages, properties));
// Update the blocks. // Update the blocks.
m_memory_block_manager.Update(std::addressof(allocator), address, num_pages, state, perm, m_memory_block_manager.Update(std::addressof(allocator), address, num_pages, state, perm,

View file

@ -441,7 +441,7 @@ private:
Svc::MemoryState state) const; Svc::MemoryState state) const;
Result AllocateAndMapPagesImpl(PageLinkedList* page_list, KProcessAddress address, Result AllocateAndMapPagesImpl(PageLinkedList* page_list, KProcessAddress address,
size_t num_pages, KMemoryPermission perm); size_t num_pages, KPageProperties& perm);
Result MapPageGroupImpl(PageLinkedList* page_list, KProcessAddress address, Result MapPageGroupImpl(PageLinkedList* page_list, KProcessAddress address,
const KPageGroup& pg, const KPageProperties properties, bool reuse_ll); const KPageGroup& pg, const KPageProperties properties, bool reuse_ll);