[Lldb-commits] [lldb] [lldb][AArch64] Add SME2's ZT0 register (PR #70205)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 25 11:54:07 PDT 2023


================
@@ -625,6 +662,18 @@ NativeRegisterContextLinux_arm64::CacheAllRegisters(uint32_t &cached_size) {
     error = ReadZA();
     if (error.Fail())
       return error;
+
+    // We will only be restoring ZT data if ZA is active. As writing to an
+    // inactive ZT enables ZA, which may not be desireable.
+    if (GetRegisterInfo().IsZTEnabled() &&
+        m_za_header.size > sizeof(m_za_header)) {
----------------
bulbazord wrote:

The comment and the code are a little confusing to me. Reading the code, it's not obvious that `GetRegisterInfo().IsZTEnabled() && m_za_header.size > sizeof(m_za_header)` checks to see if ZA is active. This reads to me like "if ZT0 is enabled and the za header is filled in correctly".

Why is "is ZT0 enabled" a condition if we just need to check ZA? Sorry if this is a noob question, I'm trying to learn more about this so I can help review these patches. 😄 

I also see you doing this below, might be good to build an abstraction for this?

https://github.com/llvm/llvm-project/pull/70205


More information about the lldb-commits mailing list