Skip to content

Commit

Permalink
[lldb] [Process/Linux] Support arbitrarily-sized FPR writes on ARM
Browse files Browse the repository at this point in the history
Support arbitrarily-sized FPR writes on ARM in order to fix writing qN
registers directly.  Currently, writing them works only by accident
due to value_regs splitting them into smaller writes via dN and sN
registers.

Differential Revision: https://reviews.llvm.org/D112131
  • Loading branch information
mgorny committed Oct 20, 2021
1 parent be6c8dc commit 192331b
Showing 1 changed file with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,9 @@ NativeRegisterContextLinux_arm::WriteRegister(const RegisterInfo *reg_info,
uint32_t fpr_offset = CalculateFprOffset(reg_info);
assert(fpr_offset < sizeof m_fpr);
uint8_t *dst = (uint8_t *)&m_fpr + fpr_offset;
switch (reg_info->byte_size) {
case 2:
*(uint16_t *)dst = reg_value.GetAsUInt16();
break;
case 4:
*(uint32_t *)dst = reg_value.GetAsUInt32();
break;
case 8:
*(uint64_t *)dst = reg_value.GetAsUInt64();
break;
default:
assert(false && "Unhandled data size.");
return Status("unhandled register data size %" PRIu32,
reg_info->byte_size);
}
::memcpy(dst, reg_value.GetBytes(), reg_info->byte_size);

Status error = WriteFPR();
if (error.Fail())
return error;

return Status();
return WriteFPR();
}

return Status("failed - register wasn't recognized to be a GPR or an FPR, "
Expand Down

0 comments on commit 192331b

Please sign in to comment.