Skip to content

Commit

Permalink
Update canonize to fix aarch64 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vihangm committed Jan 30, 2025
1 parent dbc85c4 commit 2f1d365
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shared/source/gmm_helper/gmm_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ GmmHelper::GmmHelper(const RootDeviceEnvironment &rootDeviceEnvironmentArg) : ro
}

uint64_t GmmHelper::canonize(uint64_t address) const {
#if defined(__aarch64__)
// Memory layout on aarch64 doesn't require setting bits 63-48 to the same
// as bit 47. See https://docs.kernel.org/arch/arm64/memory.html
return static_cast<int64_t>(address);
#else
return static_cast<int64_t>(address << (64 - addressWidth)) >> (64 - addressWidth);
#endif
}

uint64_t GmmHelper::decanonize(uint64_t address) const {
Expand Down

0 comments on commit 2f1d365

Please sign in to comment.