Skip to content

Commit 240d90c

Browse files
committed
Fix get_accessed_pages to include 4KB pages.
1 parent a97f730 commit 240d90c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/tinykvm/amd64/paging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ std::vector<std::pair<uint64_t, uint64_t>> get_accessed_pages(const vMemory& mem
552552
std::vector<std::pair<uint64_t, uint64_t>> accessed_pages;
553553
foreach_page(memory,
554554
[&accessed_pages] (uint64_t addr, uint64_t& entry, size_t size) {
555-
if ((entry & (PDE64_PS | PDE64_ACCESSED | PDE64_PRESENT)) == (PDE64_PS | PDE64_ACCESSED | PDE64_PRESENT)) {
555+
if ((entry & (PDE64_ACCESSED | PDE64_PRESENT)) == (PDE64_ACCESSED | PDE64_PRESENT) &&
556+
((entry & PDE64_PS) || (size == PAGE_SIZE))) {
556557
accessed_pages.push_back({addr & PDE64_ADDR_MASK, size});
557558
}
558559
}, false);

0 commit comments

Comments
 (0)