mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
UserspaceEmulator: Mark mmap regions as malloc blocks when mallocing
We don't have to be clever at all to figure out which MmapRegions are malloc blocks, we can just mark the containing region as such when the emulated process performs a malloc! :^)
This commit is contained in:
parent
5de7bae383
commit
030edbd513
3 changed files with 7 additions and 8 deletions
|
@ -44,6 +44,10 @@ void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t siz
|
|||
ASSERT(region);
|
||||
ASSERT(region->is_mmap());
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
|
||||
// Mark the containing mmap region as a malloc block!
|
||||
mmap_region.set_malloc(true);
|
||||
|
||||
auto* shadow_bits = mmap_region.shadow_data() + address - mmap_region.base();
|
||||
memset(shadow_bits, 0, size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue