Skip to content

[lldb][debugserver] Save and restore the SVE/SME register state (#134184) #10421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2952,8 +2952,15 @@ kern_return_t DNBArchMachARM64::SetRegisterState(int set) {
return err;

switch (set) {
case e_regSetALL:
return SetGPRState() | SetVFPState() | SetEXCState() | SetDBGState(false);
case e_regSetALL: {
kern_return_t ret =
SetGPRState() | SetVFPState() | SetEXCState() | SetDBGState(false);
if (CPUHasSME()) {
SetSVEState();
SetSMEState();
}
return ret;
}
case e_regSetGPR:
return SetGPRState();
case e_regSetVFP:
Expand Down Expand Up @@ -3123,6 +3130,12 @@ uint32_t DNBArchMachARM64::SaveRegisterState() {
"error: %s regs failed to read: %u",
"VFP", kret);
} else {
if (CPUHasSME()) {
// These can fail when processor is not in streaming SVE mode,
// and that failure should be ignored.
GetSVEState(force);
GetSMEState(force);
}
const uint32_t save_id = GetNextRegisterStateSaveID();
m_saved_register_states[save_id] = m_state.context;
return save_id;
Expand Down Expand Up @@ -3150,6 +3163,12 @@ bool DNBArchMachARM64::RestoreRegisterState(uint32_t save_id) {
save_id, "VFP", kret);
success = false;
}
if (CPUHasSME()) {
// These can fail when processor is not in streaming SVE mode,
// and that failure should be ignored.
SetSVEState();
SetSMEState();
}
m_saved_register_states.erase(pos);
return success;
}
Expand Down