1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

UserspaceEmulator: Convert backing storage from malloc to mmap

This saves a few bytes for each guest-mmaped region, especially since these are likely to be page-aligned.
This commit is contained in:
Ben Wiederhake 2021-03-07 21:39:06 +01:00 committed by Andreas Kling
parent 968ad0f8d1
commit 7cc8f20a30
3 changed files with 28 additions and 16 deletions

View file

@ -57,7 +57,7 @@ public:
if (address.selector() == 0x2b)
return m_tls_region.ptr();
size_t page_index = (address.offset() & ~(PAGE_SIZE - 1)) / PAGE_SIZE;
size_t page_index = address.offset() / PAGE_SIZE;
return m_page_to_region_map[page_index];
}