SWDEV-557412 - Incorporate proper chunk offset when remapping virtual memory (#1848)
* SWDEV-557412 - Incorporate proper offset when remapping virtual memory * Fix condition to check if VMHeap allocation address matches a chunk address * Move offset calculation outside if/else block --------- Co-authored-by: JeniferC99 <150404595+JeniferC99@users.noreply.github.com>
Этот коммит содержится в:
1 родитель
daf8596ce9
Коммит
cce94f6ee0
2 files changed
+10
-5
No files matched your search
@@ -239,7 +239,10 @@ address VmHeap::Alloc(size_t size) {
|
||||
size_t offset = 0;
|
||||
auto hb = AllocBlock(size + block_alignment_);
|
||||
if (hb != nullptr) {
|
||||
offset = ((hb->Offset() & ~kChunkSize) == 0) ? hb->Offset() + block_alignment_ : hb->Offset();
|
||||
// Add 256-byte offset if virtual address matches chunk address to avoid map conflicts
|
||||
offset = ((hb->Offset() & (kChunkSize - 1)) == 0)
|
||||
? hb->Offset() + block_alignment_
|
||||
: hb->Offset();
|
||||
ptr = base_address_ + offset;
|
||||
} else {
|
||||
return nullptr;
|
||||
|
||||
Reference in new issue
Block a user