DavidSpickett added inline comments.
================
Comment at:
lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp:43
+
+ptrdiff_t MemoryTagManagerAArch64MTE::AddressDiff(lldb::addr_t addr1,
+ lldb::addr_t addr2) const {
----------------
omjavaid wrote:
> I am a little apprehensive about this AddressDiff function. AArch64 virtual
> address is either 48 bits or 52 bits. MTE start from 56th bit and I believe
> bits (48 - 55) will be either set zero (for user address) and set to one for
> kernel addresses.
> I am not sure if there is an interface available for us to know if VA is 48
> or 52 bits. What do you think how should we manage this here.
I looked at this a while back and there is no user space way to tell what size
virtual address you have. You can assume at least 48 but then the rest I think
is handled by some backwards compatibility stuff that means you don't have to
care.
What is an issue is this only ignores the tag bits, not the whole top byte.
This is the instruction the ptrdiff intrinsic emits:
```
C6.2.317 SUBPS
Subtract Pointer, setting Flags subtracts the 56-bit address held in the second
source register from the 56-bit address
held in the first source register, sign-extends the result to 64-bits, and
writes the result to the destination register. It
updates the condition flags based on the result of the subtraction.
```
That assumes top byte ignore, so I should be doing the same here along with the
sign extension to handle the 0/1 fill.
(this might apply to a lot more than just this diff call too)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97281/new/
https://reviews.llvm.org/D97281
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits