SWDEV-355281 - Add offset calculation

Calculate memory location offset for requested memory

Change-Id: I7919523df1790d9eaad5827ee5bd98e4263a7554


[ROCm/clr commit: 5d83345c20]
このコミットが含まれているのは:
German Andryeyev committed 2023-01-16 14:19:40 -05:00
1 親 19c80916fa
コミット 8ad3120e25
2ファイル変更
+6 -2

検索条件に一致するファイルはありません

+4 -1
ファイルの表示
@@ -296,7 +296,7 @@ void MemObjMap::RemoveMemObj(const void* k) {
}
}
amd::Memory* MemObjMap::FindMemObj(const void* k) {
amd::Memory* MemObjMap::FindMemObj(const void* k, size_t* offset) {
amd::ScopedLock lock(AllocatedLock_);
uintptr_t key = reinterpret_cast<uintptr_t>(k);
auto it = MemObjMap_.upper_bound(key);
@@ -307,6 +307,9 @@ amd::Memory* MemObjMap::FindMemObj(const void* k) {
--it;
amd::Memory* mem = it->second;
if (key >= it->first && key < (it->first + mem->getSize())) {
if (offset != nullptr) {
*offset = key - it->first;
}
// the k is in the range
return mem;
} else {