Open gifti258 opened 1 week ago
@llvm/issue-subscribers-lldb
Author: Giftpflanze (gifti258)
@llvm/issue-subscribers-backend-aarch64
Author: Giftpflanze (gifti258)
From the architecture rules point of view, I agree.
However, it seems that CPSR became an alternative name for pstate in several projects.
Darwin/XNU calls it CPSR on arm64 - https://github.com/search?q=repo%3Aapple-oss-distributions%2Fxnu+cpsr&type=code As does FreeBSD - https://github.com/search?q=repo%3Afreebsd%2Ffreebsd-src+cpsr+NOT+path%3A%2F%5Econtrib%5C%2Fllvm-project%5C%2Fllvm%5C%2Flib%5C%2F%2F+NOT+path%3A%2F%5Econtrib%5C%2F%2F+path%3A%2F%5Esys%5C%2Farm64%5C%2F%2F&type=code Linux does not - https://github.com/search?q=repo%3Atorvalds%2Flinux+cpsr+path%3A%2F%5Earch%5C%2Farm64%5C%2F%2F&type=code (probably because having an AArch32 compatibility mode made them think more carefully about the differences) QEMU calls it pstate - https://gitlab.com/qemu-project/qemu/-/blob/master/target/arm/gdbstub64.c?ref_type=heads
And this has bug has been raised with GDB too - https://sourceware.org/bugzilla/show_bug.cgi?id=23408
Generally register naming is driven via XML from the debug stub, so older stubs will always call it CPSR. Likely lots of software written against GDB and our stubs will assume "cpsr" will be present.
What we could do is provide an alias for users, as we do for ABI reserved registers like x30
/lr
. I think the ABI plugins handle this?
Maybe some internal naming could change, but I don't think it would be worth the churn. I know that we treat "cpsr" as 32 bit and we may need to extend that in future so if we end up doing refactoring for that perhaps it's a good time to start calling it pstate.
I have also seen software call it "spsr" saved program status register, which is technically what you're seeing in a debugger, or "xpsr" but this one seems to be only in ARM 32 bit contexts.
There is no CPSR register in arm64, only in arm32. The name of the register in lldb
register read
output, etc. should probably bepstate
, which is the corresponding flags register on arm64.