aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h
blob: c7a2451d7811c81b859d745757878c0c3be0077f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
//===-- RegisterContextPOSIX_powerpc.h ---------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_RegisterContextPOSIX_powerpc_H_
#define liblldb_RegisterContextPOSIX_powerpc_H_

#include "lldb/Core/Log.h"
#include "RegisterContextPOSIX.h"
#include "RegisterContext_powerpc.h"

class ProcessMonitor;

// ---------------------------------------------------------------------------
// Internal codes for all powerpc registers.
// ---------------------------------------------------------------------------
enum
{
    k_first_gpr_powerpc,
    gpr_r0_powerpc = k_first_gpr_powerpc,
    gpr_r1_powerpc,
    gpr_r2_powerpc,
    gpr_r3_powerpc,
    gpr_r4_powerpc,
    gpr_r5_powerpc,
    gpr_r6_powerpc,
    gpr_r7_powerpc,
    gpr_r8_powerpc,
    gpr_r9_powerpc,
    gpr_r10_powerpc,
    gpr_r11_powerpc,
    gpr_r12_powerpc,
    gpr_r13_powerpc,
    gpr_r14_powerpc,
    gpr_r15_powerpc,
    gpr_r16_powerpc,
    gpr_r17_powerpc,
    gpr_r18_powerpc,
    gpr_r19_powerpc,
    gpr_r20_powerpc,
    gpr_r21_powerpc,
    gpr_r22_powerpc,
    gpr_r23_powerpc,
    gpr_r24_powerpc,
    gpr_r25_powerpc,
    gpr_r26_powerpc,
    gpr_r27_powerpc,
    gpr_r28_powerpc,
    gpr_r29_powerpc,
    gpr_r30_powerpc,
    gpr_r31_powerpc,
    gpr_lr_powerpc,
    gpr_cr_powerpc,
    gpr_xer_powerpc,
    gpr_ctr_powerpc,
    gpr_pc_powerpc,
    k_last_gpr_powerpc = gpr_pc_powerpc,

    k_first_fpr,
    fpr_f0_powerpc = k_first_fpr,
    fpr_f1_powerpc,
    fpr_f2_powerpc,
    fpr_f3_powerpc,
    fpr_f4_powerpc,
    fpr_f5_powerpc,
    fpr_f6_powerpc,
    fpr_f7_powerpc,
    fpr_f8_powerpc,
    fpr_f9_powerpc,
    fpr_f10_powerpc,
    fpr_f11_powerpc,
    fpr_f12_powerpc,
    fpr_f13_powerpc,
    fpr_f14_powerpc,
    fpr_f15_powerpc,
    fpr_f16_powerpc,
    fpr_f17_powerpc,
    fpr_f18_powerpc,
    fpr_f19_powerpc,
    fpr_f20_powerpc,
    fpr_f21_powerpc,
    fpr_f22_powerpc,
    fpr_f23_powerpc,
    fpr_f24_powerpc,
    fpr_f25_powerpc,
    fpr_f26_powerpc,
    fpr_f27_powerpc,
    fpr_f28_powerpc,
    fpr_f29_powerpc,
    fpr_f30_powerpc,
    fpr_f31_powerpc,
    fpr_fpscr_powerpc,
    k_last_fpr = fpr_fpscr_powerpc,

    k_first_vmx,
    vmx_v0_powerpc = k_first_vmx,
    vmx_v1_powerpc,
    vmx_v2_powerpc,
    vmx_v3_powerpc,
    vmx_v4_powerpc,
    vmx_v5_powerpc,
    vmx_v6_powerpc,
    vmx_v7_powerpc,
    vmx_v8_powerpc,
    vmx_v9_powerpc,
    vmx_v10_powerpc,
    vmx_v11_powerpc,
    vmx_v12_powerpc,
    vmx_v13_powerpc,
    vmx_v14_powerpc,
    vmx_v15_powerpc,
    vmx_v16_powerpc,
    vmx_v17_powerpc,
    vmx_v18_powerpc,
    vmx_v19_powerpc,
    vmx_v20_powerpc,
    vmx_v21_powerpc,
    vmx_v22_powerpc,
    vmx_v23_powerpc,
    vmx_v24_powerpc,
    vmx_v25_powerpc,
    vmx_v26_powerpc,
    vmx_v27_powerpc,
    vmx_v28_powerpc,
    vmx_v29_powerpc,
    vmx_v30_powerpc,
    vmx_v31_powerpc,
    vmx_vrsave_powerpc,
    vmx_vscr_powerpc,
    k_last_vmx = vmx_vscr_powerpc,

    k_num_registers_powerpc,
    k_num_gpr_registers_powerpc = k_last_gpr_powerpc - k_first_gpr_powerpc + 1,
    k_num_fpr_registers_powerpc = k_last_fpr - k_first_fpr + 1,
    k_num_vmx_registers_powerpc = k_last_vmx - k_first_vmx + 1,
};

class RegisterContextPOSIX_powerpc
  : public lldb_private::RegisterContext
{
public:
    RegisterContextPOSIX_powerpc (lldb_private::Thread &thread,
                            uint32_t concrete_frame_idx,
                            lldb_private::RegisterInfoInterface *register_info);

    ~RegisterContextPOSIX_powerpc();

    void
    Invalidate();

    void
    InvalidateAllRegisters();

    size_t
    GetRegisterCount();

    virtual size_t
    GetGPRSize();

    virtual unsigned
    GetRegisterSize(unsigned reg);

    virtual unsigned
    GetRegisterOffset(unsigned reg);

    const lldb_private::RegisterInfo *
    GetRegisterInfoAtIndex(size_t reg);

    size_t
    GetRegisterSetCount();

    const lldb_private::RegisterSet *
    GetRegisterSet(size_t set);

    const char *
    GetRegisterName(unsigned reg);

    uint32_t
    ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num);

protected:
    uint64_t m_gpr_powerpc[k_num_gpr_registers_powerpc];         // general purpose registers.
    uint64_t m_fpr_powerpc[k_num_fpr_registers_powerpc];         // floating point registers.
    uint32_t m_vmx_powerpc[k_num_vmx_registers_powerpc][4];
    std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)

    // Determines if an extended register set is supported on the processor running the inferior process.
    virtual bool
    IsRegisterSetAvailable(size_t set_index);

    virtual const lldb_private::RegisterInfo *
    GetRegisterInfo();

    bool
    IsGPR(unsigned reg);

    bool
    IsFPR(unsigned reg);

    bool
    IsVMX(unsigned reg);

    lldb::ByteOrder GetByteOrder();

    virtual bool ReadGPR() = 0;
    virtual bool ReadFPR() = 0;
    virtual bool ReadVMX() = 0;
    virtual bool WriteGPR() = 0;
    virtual bool WriteFPR() = 0;
    virtual bool WriteVMX() = 0;
};

#endif // #ifndef liblldb_RegisterContextPOSIX_powerpc_H_