kern: use callback to note pte updates in KPageTableImpl

This commit is contained in:
Michael Scire
2025-04-30 22:31:25 -07:00
committed by SciresM
parent 28296e2aac
commit 4580a352c0
4 changed files with 21 additions and 12 deletions

View File

@@ -752,13 +752,10 @@ namespace ams::kern::arch::arm64 {
while (true) {
/* Try to merge. */
KVirtualAddress freed_table = Null<KVirtualAddress>;
if (!impl.MergePages(std::addressof(freed_table), context)) {
if (!impl.MergePages(std::addressof(freed_table), context, &KPageTable::NoteUpdatedCallback, this)) {
break;
}
/* Note that we updated. */
this->NoteUpdated();
/* Free the page. */
if (freed_table != Null<KVirtualAddress>) {
ClearPageTable(freed_table);
@@ -816,8 +813,7 @@ namespace ams::kern::arch::arm64 {
}
/* Separate. */
impl.SeparatePages(entry, context, virt_addr, GetPointer<PageTableEntry>(table));
this->NoteUpdated();
impl.SeparatePages(entry, context, virt_addr, GetPointer<PageTableEntry>(table), &KPageTable::NoteUpdatedCallback, this);
}
R_SUCCEED();
@@ -1025,6 +1021,9 @@ namespace ams::kern::arch::arm64 {
/* Finally, apply the changes as directed, flushing the mappings before they're applied (if we should). */
ApplyEntryTemplate(entry_template, flush_mapping ? ApplyOption_FlushDataCache : ApplyOption_None);
/* Wait for pending stores to complete. */
cpu::DataSynchronizationBarrierInnerShareableStore();
}
/* We've succeeded, now perform what coalescing we can. */