[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:42:48 PDT 2020
mgorny created this revision.
mgorny added reviewers: labath, krytarowski.
mgorny requested review of this revision.
Ensure that xs_xstate_bv is set correctly before calling
WriteRegisterSet(). The bit can be clear if the relevant registers
were at their initial state when they were read, and it needs to be set
in order to apply changes from the XState structure.
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
@@ -894,33 +894,43 @@
#endif
case lldb_fctrl_x86_64:
m_xstate.xs_fxsave.fx_cw = reg_value.GetAsUInt16();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_fstat_x86_64:
m_xstate.xs_fxsave.fx_sw = reg_value.GetAsUInt16();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_ftag_x86_64:
m_xstate.xs_fxsave.fx_tw = reg_value.GetAsUInt16();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_fop_x86_64:
m_xstate.xs_fxsave.fx_opcode = reg_value.GetAsUInt16();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_fiseg_x86_64:
m_xstate.xs_fxsave.fx_ip.fa_32.fa_seg = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_fioff_x86_64:
m_xstate.xs_fxsave.fx_ip.fa_32.fa_off = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_foseg_x86_64:
m_xstate.xs_fxsave.fx_dp.fa_32.fa_seg = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_fooff_x86_64:
m_xstate.xs_fxsave.fx_dp.fa_32.fa_off = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_mxcsr_x86_64:
m_xstate.xs_fxsave.fx_mxcsr = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_SSE;
break;
case lldb_mxcsrmask_x86_64:
m_xstate.xs_fxsave.fx_mxcsr_mask = reg_value.GetAsUInt32();
+ m_xstate.xs_xstate_bv |= XCR0_SSE;
break;
case lldb_st0_x86_64:
case lldb_st1_x86_64:
@@ -932,6 +942,7 @@
case lldb_st7_x86_64:
::memcpy(&m_xstate.xs_fxsave.fx_87_ac[reg - lldb_st0_x86_64],
reg_value.GetBytes(), reg_value.GetByteSize());
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_mm0_x86_64:
case lldb_mm1_x86_64:
@@ -943,6 +954,7 @@
case lldb_mm7_x86_64:
::memcpy(&m_xstate.xs_fxsave.fx_87_ac[reg - lldb_mm0_x86_64],
reg_value.GetBytes(), reg_value.GetByteSize());
+ m_xstate.xs_xstate_bv |= XCR0_X87;
break;
case lldb_xmm0_x86_64:
case lldb_xmm1_x86_64:
@@ -966,6 +978,7 @@
} else {
::memcpy(&m_xstate.xs_fxsave.fx_xmm[reg - lldb_xmm0_x86_64],
reg_value.GetBytes(), reg_value.GetByteSize());
+ m_xstate.xs_xstate_bv |= XCR0_SSE;
}
break;
case lldb_ymm0_x86_64:
@@ -994,6 +1007,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);
+ m_xstate.xs_xstate_bv |= XCR0_SSE | XCR0_YMM_Hi128;
}
break;
case lldb_dr0_x86_64:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90105.300504.patch
Type: text/x-patch
Size: 2962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201024/456add1d/attachment.bin>
More information about the lldb-commits
mailing list