[Lldb-commits] [PATCH] D90105: [lldb] [Process/NetBSD] Set xs_xstate_bv correctly when setting regs

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 24 14:46:53 PDT 2020


mgorny updated this revision to Diff 300505.
mgorny added a comment.

Reduce the repetition by bringing the most common case out.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90105/new/

https://reviews.llvm.org/D90105

Files:
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
===================================================================
--- lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -754,6 +754,8 @@
     return error;
   }
 
+  uint64_t new_xstate_bv = XCR0_X87;  // the most common case
+
   switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
   case llvm::Triple::x86_64:
     break;
@@ -918,9 +920,11 @@
     break;
   case lldb_mxcsr_x86_64:
     m_xstate.xs_fxsave.fx_mxcsr = reg_value.GetAsUInt32();
+    new_xstate_bv = XCR0_SSE;
     break;
   case lldb_mxcsrmask_x86_64:
     m_xstate.xs_fxsave.fx_mxcsr_mask = reg_value.GetAsUInt32();
+    new_xstate_bv = XCR0_SSE;
     break;
   case lldb_st0_x86_64:
   case lldb_st1_x86_64:
@@ -966,6 +970,7 @@
     } else {
       ::memcpy(&m_xstate.xs_fxsave.fx_xmm[reg - lldb_xmm0_x86_64],
                reg_value.GetBytes(), reg_value.GetByteSize());
+      new_xstate_bv = XCR0_SSE;
     }
     break;
   case lldb_ymm0_x86_64:
@@ -994,6 +999,7 @@
       ::memcpy(ymm.bytes, reg_value.GetBytes(), reg_value.GetByteSize());
       YMMToXState(ymm, m_xstate.xs_fxsave.fx_xmm[reg_index].xmm_bytes,
                   m_xstate.xs_ymm_hi128.xs_ymm[reg_index].ymm_bytes);
+      new_xstate_bv = XCR0_SSE | XCR0_YMM_Hi128;
     }
     break;
   case lldb_dr0_x86_64:
@@ -1010,6 +1016,9 @@
     llvm_unreachable("Reading unknown/unsupported register");
   }
 
+  if (set == XStateRegSet)
+    m_xstate.xs_xstate_bv |= new_xstate_bv;
+
   return WriteRegisterSet(set);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90105.300505.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201024/686ad3e8/attachment.bin>


More information about the lldb-commits mailing list