gdb/amdgcn: Dynamically select which bits to use to hold CORE_ADDR#56
Open
amd-shahab wants to merge 1 commit intoamd-stagingfrom
Open
gdb/amdgcn: Dynamically select which bits to use to hold CORE_ADDR#56amd-shahab wants to merge 1 commit intoamd-stagingfrom
amd-shahab wants to merge 1 commit intoamd-stagingfrom
Conversation
ed82c64 to
187e19d
Compare
To support the various address-spaces from AMDGPU, amdgpu-tdep implements gdbarch hooks to encode the address-space ID in the top bits of a CORE_ADDR. Exactly which bits to use out of the CORE_ADDR is currently statically built into GDB. However, for AMDGPU, the "flat" address-space (also known as generic) is configured by the driver, and it is not part of the ABI which bits out of the top byte are used or not to carry meaning. To address this, librocm-dbgapi >= 0.80 provides a mask of bits which carry information for the current process. GDB can use this mask to deduce which bits out of a CORE_ADDR can safely be used to encode address space IDs. This patch provides an implementation for GDB to encode the address-space ID into the top bits reported as unused by dbgapi. Note that dbgapi reports which bits can be used by any address space, including "global". This means that the unused bits must be the top ones, and we should account for the fact that "normalized" addresses are sign extended in the top bits. This means that the top bits of a valid address can be either all 0s or all 1s. For this reason, we do not support encoding an address space ID whose binary representation on the available bits of a CORE_ADDR is all 1s, so the all 1s case can be reserved for sign-extended addresses. Bug: AIROCGDB-26 Change-Id: I4cbb41a922443d64003ebc6415547c02ab43afcf
187e19d to
0f7b779
Compare
Contributor
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relies on dbgapi's PR: Add AMD_DBGAPI_PROCESS_INFO_SIGNIFICANT_ADDRESS_BITS
To support the various address-spaces from AMDGPU, amdgpu-tdep implements gdbarch hooks to encode the address-space ID in the top bits of a CORE_ADDR. Exactly which bits to use out of the CORE_ADDR is currently statically built into GDB. However, for AMDGPU, the "flat" address-space (also known as generic) is configured by the driver, and it is not part of the ABI which bits out of the top byte are used or not to carry meaning.
To address this, librocm-dbgapi >= 0.80 provides a mask of bits which carry information for the current process. GDB can use this mask to deduce which bits out of a CORE_ADDR can safely be used to encode address space IDs.
This patch provides an implementation for GDB to encode the address-space ID into the top bits reported as unused by dbgapi. Note that dbgapi reports which bits can be used by any address space, including "global". This means that the unused bits must be the top ones, and we should account for the fact that "normalized" addresses are sign extended in the top bits. This means that the top bits of a valid address can be either all 0s or all 1s. For this reason, we do not support encoding an address space ID whose binary representation on the available bits of a CORE_ADDR is all 1s, so the all 1s case can be reserved for sign-extended addresses.
Bug: AIROCGDB-26
Change-Id: I4cbb41a922443d64003ebc6415547c02ab43afcf