1 //===-- RegisterContextPOSIXCore_s390x.cpp --------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "RegisterContextPOSIXCore_s390x.h"
11 #include "lldb/Target/Thread.h"
12 #include "lldb/Utility/DataBufferHeap.h"
13 #include "lldb/Utility/RegisterValue.h"
17 using namespace lldb_private
;
19 RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(
20 Thread
&thread
, RegisterInfoInterface
*register_info
,
21 const DataExtractor
&gpregset
, llvm::ArrayRef
<CoreNote
> notes
)
22 : RegisterContextPOSIX_s390x(thread
, 0, register_info
) {
23 m_gpr_buffer
= std::make_shared
<DataBufferHeap
>(gpregset
.GetDataStart(),
24 gpregset
.GetByteSize());
25 m_gpr
.SetData(m_gpr_buffer
);
26 m_gpr
.SetByteOrder(gpregset
.GetByteOrder());
28 DataExtractor fpregset
= getRegset(
29 notes
, register_info
->GetTargetArchitecture().GetTriple(), FPR_Desc
);
30 m_fpr_buffer
= std::make_shared
<DataBufferHeap
>(fpregset
.GetDataStart(),
31 fpregset
.GetByteSize());
32 m_fpr
.SetData(m_fpr_buffer
);
33 m_fpr
.SetByteOrder(fpregset
.GetByteOrder());
36 RegisterContextCorePOSIX_s390x::~RegisterContextCorePOSIX_s390x() = default;
38 bool RegisterContextCorePOSIX_s390x::ReadGPR() { return true; }
40 bool RegisterContextCorePOSIX_s390x::ReadFPR() { return true; }
42 bool RegisterContextCorePOSIX_s390x::WriteGPR() {
47 bool RegisterContextCorePOSIX_s390x::WriteFPR() {
52 bool RegisterContextCorePOSIX_s390x::ReadRegister(const RegisterInfo
*reg_info
,
53 RegisterValue
&value
) {
54 const uint32_t reg
= reg_info
->kinds
[lldb::eRegisterKindLLDB
];
55 if (reg
== LLDB_INVALID_REGNUM
)
59 lldb::offset_t offset
= reg_info
->byte_offset
;
60 uint64_t v
= m_gpr
.GetMaxU64(&offset
, reg_info
->byte_size
);
61 if (offset
== reg_info
->byte_offset
+ reg_info
->byte_size
) {
62 value
.SetUInt(v
, reg_info
->byte_size
);
68 lldb::offset_t offset
= reg_info
->byte_offset
;
69 uint64_t v
= m_fpr
.GetMaxU64(&offset
, reg_info
->byte_size
);
70 if (offset
== reg_info
->byte_offset
+ reg_info
->byte_size
) {
71 value
.SetUInt(v
, reg_info
->byte_size
);
79 bool RegisterContextCorePOSIX_s390x::ReadAllRegisterValues(
80 lldb::WritableDataBufferSP
&data_sp
) {
84 bool RegisterContextCorePOSIX_s390x::WriteRegister(const RegisterInfo
*reg_info
,
85 const RegisterValue
&value
) {
89 bool RegisterContextCorePOSIX_s390x::WriteAllRegisterValues(
90 const lldb::DataBufferSP
&data_sp
) {
94 bool RegisterContextCorePOSIX_s390x::HardwareSingleStep(bool enable
) {