mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
UserspaceEmulator: Make big malloc block lookup O(1) as well
By passing the Region& to the auditing functions, we know exactly which block we are hitting. This allows us to track big mallocations the same way we already do chunked ones. This gets rid of the O(n) scan in find_mallocation() for allocations larger than the maximum malloc chunk size. :^)
This commit is contained in:
parent
8d9dd4c518
commit
e1f617950e
4 changed files with 57 additions and 55 deletions
|
@ -260,7 +260,7 @@ bool SoftMMU::fast_fill_memory8(X86::LogicalAddress address, size_t size, ValueW
|
|||
if (auto* tracer = Emulator::the().malloc_tracer()) {
|
||||
// FIXME: Add a way to audit an entire range of memory instead of looping here!
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
tracer->audit_write(address.offset() + (i * sizeof(u8)), sizeof(u8));
|
||||
tracer->audit_write(*region, address.offset() + (i * sizeof(u8)), sizeof(u8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ bool SoftMMU::fast_fill_memory32(X86::LogicalAddress address, size_t count, Valu
|
|||
if (auto* tracer = Emulator::the().malloc_tracer()) {
|
||||
// FIXME: Add a way to audit an entire range of memory instead of looping here!
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
tracer->audit_write(address.offset() + (i * sizeof(u32)), sizeof(u32));
|
||||
tracer->audit_write(*region, address.offset() + (i * sizeof(u32)), sizeof(u32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue