LLDB mainline
NativeRegisterContextLinux_s390x.h
Go to the documentation of this file.
1//===-- NativeRegisterContextLinux_s390x.h ----------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#if defined(__s390x__) && defined(__linux__)
10
11#ifndef lldb_NativeRegisterContextLinux_s390x_h
12#define lldb_NativeRegisterContextLinux_s390x_h
13
17#include <asm/ptrace.h>
18
19namespace lldb_private {
20namespace process_linux {
21
22class NativeProcessLinux;
23
24class NativeRegisterContextLinux_s390x : public NativeRegisterContextLinux {
25public:
26 NativeRegisterContextLinux_s390x(const ArchSpec &target_arch,
27 NativeThreadProtocol &native_thread);
28
29 uint32_t GetRegisterSetCount() const override;
30
31 const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
32
33 uint32_t GetUserRegisterCount() const override;
34
35 Status ReadRegister(const RegisterInfo *reg_info,
36 RegisterValue &reg_value) override;
37
38 Status WriteRegister(const RegisterInfo *reg_info,
39 const RegisterValue &reg_value) override;
40
41 Status ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override;
42
43 Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
44
45 Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
46
47 Status GetWatchpointHitIndex(uint32_t &wp_index,
48 lldb::addr_t trap_addr) override;
49
50 Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override;
51
52 bool ClearHardwareWatchpoint(uint32_t wp_index) override;
53
54 Status ClearAllHardwareWatchpoints() override;
55
56 uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
57 uint32_t watch_flags) override;
58
59 lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override;
60
61 uint32_t NumSupportedHardwareWatchpoints() override;
62
63protected:
64 Status DoReadRegisterValue(uint32_t offset, const char *reg_name,
65 uint32_t size, RegisterValue &value) override;
66
67 Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,
68 const RegisterValue &value) override;
69
70 Status ReadGPR() override;
71
72 Status WriteGPR() override;
73
74 Status ReadFPR() override;
75
76 Status WriteFPR() override;
77
78 void *GetGPRBuffer() override { return &m_regs; }
79 size_t GetGPRSize() const override { return sizeof(m_regs); }
80 void *GetFPRBuffer() override { return &m_fp_regs; }
81 size_t GetFPRSize() override { return sizeof(m_fp_regs); }
82
83private:
84 // Info about register ranges.
85 struct RegInfo {
86 uint32_t num_registers;
87 uint32_t num_gpr_registers;
88 uint32_t num_fpr_registers;
89
90 uint32_t last_gpr;
91 uint32_t first_fpr;
92 uint32_t last_fpr;
93 };
94
95 // Private member variables.
96 RegInfo m_reg_info;
97 lldb::addr_t m_watchpoint_addr;
98
99 s390_regs m_regs;
100 s390_fp_regs m_fp_regs;
101
102 // Private member methods.
103 bool IsRegisterSetAvailable(uint32_t set_index) const;
104
105 bool IsGPR(uint32_t reg_index) const;
106
107 bool IsFPR(uint32_t reg_index) const;
108
109 Status PeekUserArea(uint32_t offset, void *buf, size_t buf_size);
110
111 Status PokeUserArea(uint32_t offset, const void *buf, size_t buf_size);
112
113 Status DoReadRegisterSet(uint32_t regset, void *buf, size_t buf_size);
114
115 Status DoWriteRegisterSet(uint32_t regset, const void *buf, size_t buf_size);
116};
117
118} // namespace process_linux
119} // namespace lldb_private
120
121#endif // #ifndef lldb_NativeRegisterContextLinux_s390x_h
122
123#endif // defined(__s390x__) && defined(__linux__)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:334
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:335
uint64_t addr_t
Definition: lldb-types.h:80