Skip to content

Commit d4bb873

Browse files
committed
Update canonize to fix aarch64 bugs
Signed-off-by: Vihang Mehta <[email protected]>
1 parent dbc85c4 commit d4bb873

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

shared/source/gmm_helper/gmm_helper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ GmmHelper::GmmHelper(const RootDeviceEnvironment &rootDeviceEnvironmentArg) : ro
6363
}
6464

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

6975
uint64_t GmmHelper::decanonize(uint64_t address) const {

0 commit comments

Comments
 (0)