Skip to content

[MEMTAGABIELF64] Rewrite LDG as a logical operation - #412

Merged
smithp35 merged 2 commits into
ARM-software:mainfrom
smithp35:memtagldg
Aug 25, 2026
Merged

[MEMTAGABIELF64] Rewrite LDG as a logical operation#412
smithp35 merged 2 commits into
ARM-software:mainfrom
smithp35:memtagldg

Conversation

@smithp35

Copy link
Copy Markdown
Contributor

The LDG(pointer) operation is defined in terms of the runtime environment using the ldg instruction. In most cases using the ldg instruction will work on allocation tagged memory and untagged memory. However if the untagged memory cannot be read, such as when that memory is execute-only then ldg cannot be used.

Rewrite LDG(pointer) in terms of the underlying requirement which is that after the operation, pointer` has the same logical tag as the allocation tag for *pointer. With memory that is not allocation tagged having a tag of 0000.

fixes: #411

The `LDG(pointer)` operation is defined in terms of the runtime
environment using the `ldg` instruction. In most cases using the
ldg instruction will work on allocation tagged memory and untagged
memory. However if the untagged memory cannot be read, such as
when that memory is execute-only then `ldg` cannot be used.

Rewrite `LDG(pointer) in terms of the underlying requirement
which is that after the operation, `pointer` has the same
logical tag as the allocation tag for *pointer. With memory that
is not allocation tagged having a tag of 0000.

fixes: ARM-software#411

@DanielKristofKiss DanielKristofKiss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a typo, otherwise LGTM

Comment thread memtagabielf64/memtagabielf64.rst Outdated
- ``LDG(pointer)`` returns ``pointer`` with the correct logical tag
for the memory pointed to by ``pointer``. Memory without the
architectural memory attribute ``MemTag_AllocationTagged`` has a
logcal tag of ``0000``. For memory that is readable by the run-time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logcal tag of ``0000``. For memory that is readable by the run-time
logical tag of ``0000``. For memory that is readable by the run-time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the spot, will fix.

@smithp35
smithp35 merged commit 212386a into ARM-software:main Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memtag ABI: Clarify the semantics of LDG(S) in relocation processing

2 participants