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

UserspaceEmulator: Remember VM region names for MAP_ANONYMOUS

For some reason we only remembered the names of MAP_FILE mmap regions.
This commit is contained in:
Andreas Kling 2021-03-09 11:23:08 +01:00
parent 735a6482ac
commit 728d947601
3 changed files with 17 additions and 18 deletions

View file

@ -45,11 +45,12 @@ static void free_pages(void* ptr, size_t bytes)
VERIFY(rc == 0);
}
NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 prot)
NonnullOwnPtr<MmapRegion> MmapRegion::create_anonymous(u32 base, u32 size, u32 prot, String name)
{
auto data = (u8*)mmap_initialized(size, 0, nullptr);
auto shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData");
auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data));
region->m_name = move(name);
return region;
}
@ -60,10 +61,7 @@ NonnullOwnPtr<MmapRegion> MmapRegion::create_file_backed(u32 base, u32 size, u32
auto shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData");
auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data));
region->m_file_backed = true;
if (!name.is_empty()) {
name = String::formatted("{} (Emulated)", name);
region->m_name = name;
}
region->m_name = move(name);
return region;
}