1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-30 10:22:13 +00:00

Kernel: Use memset instead of fast_u32_fill in MemoryManager zero fills

When the values we're setting are not actually u32s and the size of the
area we're setting is PAGE_SIZE-aligned and a multiple of PAGE_SIZE in
size, there's no point in using fast_u32_fill, as that forces us to use
STOSDs instead of STOSQs.
This commit is contained in:
Idan Horowitz 2022-01-28 16:19:21 +02:00
parent c131e69748
commit 956824afe2

View file

@ -957,7 +957,7 @@ NonnullRefPtrVector<PhysicalPage> MemoryManager::allocate_contiguous_supervisor_
if (region_or_error.is_error())
TODO();
auto cleanup_region = region_or_error.release_value();
fast_u32_fill((u32*)cleanup_region->vaddr().as_ptr(), 0, (PAGE_SIZE * count) / sizeof(u32));
memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * count);
}
m_system_memory_info.super_physical_pages_used += count;
return physical_pages;
@ -974,7 +974,9 @@ RefPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
return {};
}
fast_u32_fill((u32*)page->paddr().offset(physical_to_virtual_offset).as_ptr(), 0, PAGE_SIZE / sizeof(u32));
auto* ptr = quickmap_page(*page);
memset(ptr, 0, PAGE_SIZE);
unquickmap_page();
++m_system_memory_info.super_physical_pages_used;
return page;
}