Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update canonize to fix aarch64 bugs #801

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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