gem5 v24.0.0.0
Loading...
Searching...
No Matches
remote_gdb.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Huawei International
3 * Copyright (c) 2017 The University of Virginia
4 * Copyright 2015 LabWare
5 * Copyright 2014 Google, Inc.
6 * Copyright (c) 2007 The Regents of The University of Michigan
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are
11 * met: redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer;
13 * redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution;
16 * neither the name of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef __ARCH_RISCV_REMOTE_GDB_HH__
34#define __ARCH_RISCV_REMOTE_GDB_HH__
35
36#include <string>
37
40#include "base/remote_gdb.hh"
41
42namespace gem5
43{
44
45class System;
46class ThreadContext;
47
48namespace RiscvISA
49{
50
52{
53 protected:
54 static const int NumGDBRegs = 4162;
55 static const int NumCSRs = 4096;
56
57 bool acc(Addr addr, size_t len) override;
58 // A breakpoint will be 2 bytes if it is compressed and 4 if not
59 bool checkBpKind(size_t kind) override { return kind == 2 || kind == 4; }
60
62 {
64 private:
74 {
76 uint32_t pc;
78 uint32_t fflags;
79 uint32_t frm;
80 uint32_t fcsr;
81 // Placeholder for byte alignment
82 uint32_t placeholder;
83 uint32_t cycle;
84 uint32_t time;
85 uint32_t cycleh;
86 uint32_t timeh;
87 uint32_t ustatus;
88 uint32_t uie;
89 uint32_t utvec;
90 uint32_t uscratch;
91 uint32_t uepc;
92 uint32_t ucause;
93 uint32_t utval;
94 uint32_t uip;
95 uint32_t sstatus;
96 uint32_t sedeleg;
97 uint32_t sideleg;
98 uint32_t sie;
99 uint32_t stvec;
100 uint32_t scounteren;
101 uint32_t sscratch;
102 uint32_t sepc;
103 uint32_t scause;
104 uint32_t stval;
105 uint32_t sip;
106 uint32_t satp;
107 uint32_t mvendorid;
108 uint32_t marchid;
109 uint32_t mimpid;
110 uint32_t mhartid;
111 uint32_t mstatus;
112 uint32_t misa;
113 uint32_t medeleg;
114 uint32_t mideleg;
115 uint32_t mie;
116 uint32_t mtvec;
117 uint32_t mcounteren;
118 uint32_t mstatush;
119 uint32_t mscratch;
120 uint32_t mepc;
121 uint32_t mcause;
122 uint32_t mtval;
123 uint32_t mip;
124 uint32_t hstatus;
125 uint32_t hedeleg;
126 uint32_t hideleg;
127 uint32_t hie;
128 uint32_t htvec;
129 uint32_t hscratch;
130 uint32_t hepc;
131 uint32_t hcause;
132 uint32_t hbadaddr;
133 uint32_t hip;
134 } r;
135 public:
136 char *data() const { return (char *)&r; }
137 size_t size() const { return sizeof(r); }
138 void getRegs(ThreadContext*);
139 void setRegs(ThreadContext*) const;
140
141 const std::string
142 name() const
143 {
144 return gdb->name() + ".RiscvGdbRegCache";
145 }
146 };
148 {
150 private:
160 {
162 uint64_t pc;
164 uint32_t fflags;
165 uint32_t frm;
166 uint32_t fcsr;
167 // Placeholder for byte alignment
168 uint32_t placeholder;
169 uint64_t cycle;
170 uint64_t time;
171 uint64_t ustatus;
172 uint64_t uie;
173 uint64_t utvec;
174 uint64_t uscratch;
175 uint64_t uepc;
176 uint64_t ucause;
177 uint64_t utval;
178 uint64_t uip;
179 uint64_t sstatus;
180 uint64_t sedeleg;
181 uint64_t sideleg;
182 uint64_t sie;
183 uint64_t stvec;
184 uint64_t scounteren;
185 uint64_t sscratch;
186 uint64_t sepc;
187 uint64_t scause;
188 uint64_t stval;
189 uint64_t sip;
190 uint64_t satp;
191 uint64_t mvendorid;
192 uint64_t marchid;
193 uint64_t mimpid;
194 uint64_t mhartid;
195 uint64_t mstatus;
196 uint64_t misa;
197 uint64_t medeleg;
198 uint64_t mideleg;
199 uint64_t mie;
200 uint64_t mtvec;
201 uint64_t mcounteren;
202 uint64_t mscratch;
203 uint64_t mepc;
204 uint64_t mcause;
205 uint64_t mtval;
206 uint64_t mip;
207 uint64_t hstatus;
208 uint64_t hedeleg;
209 uint64_t hideleg;
210 uint64_t hie;
211 uint64_t htvec;
212 uint64_t hscratch;
213 uint64_t hepc;
214 uint64_t hcause;
215 uint64_t hbadaddr;
216 uint64_t hip;
217 } r;
218 public:
219 char *data() const { return (char *)&r; }
220 size_t size() const { return sizeof(r); }
221 void getRegs(ThreadContext*);
222 void setRegs(ThreadContext*) const;
223
224 const std::string
225 name() const
226 {
227 return gdb->name() + ".RiscvGdbRegCache";
228 }
229 };
230
233
234 public:
235 RemoteGDB(System *_system, ListenSocketConfig _listen_config);
242 availableFeatures() const override
243 {
244 return {"qXfer:features:read+"};
245 };
249 bool getXferFeaturesRead(const std::string &annex,
250 std::string &output) override;
251};
252
253} // namespace RiscvISA
254} // namespace gem5
255
256#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
Definition remote_gdb.hh:86
BaseRemoteGDB * gdb
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
size_t size() const
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet).
const std::string name() const
Return the name to use in places like DPRINTF.
struct gem5::RiscvISA::RemoteGDB::Riscv32GdbRegCache::GEM5_PACKED r
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
struct gem5::RiscvISA::RemoteGDB::Riscv64GdbRegCache::GEM5_PACKED r
size_t size() const
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet).
const std::string name() const
Return the name to use in places like DPRINTF.
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
BaseGdbRegCache * gdbRegs() override
static const int NumCSRs
Definition remote_gdb.hh:55
std::vector< std::string > availableFeatures() const override
Informs GDB remote serial protocol that XML features are supported GDB then queries for xml blobs usi...
bool getXferFeaturesRead(const std::string &annex, std::string &output) override
Reply to qXfer:features:read:xxx.xml qeuries.
bool acc(Addr addr, size_t len) override
static const int NumGDBRegs
Definition remote_gdb.hh:54
bool checkBpKind(size_t kind) override
Definition remote_gdb.hh:59
Riscv32GdbRegCache regCache32
Riscv64GdbRegCache regCache64
RemoteGDB(System *_system, ListenSocketConfig _listen_config)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
STL vector class.
Definition stl.hh:37
BaseGdbRegCache(BaseRemoteGDB *g)
std::string name()
Bitfield< 18, 16 > len
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
static void output(const char *filename)
Definition debug.cc:60
RISC-V Register Cache Order and sizes of registers found in ext/gdb-xml/riscv.xml To add support for ...
Definition remote_gdb.hh:74
RISC-V Register Cache Order and sizes of registers found in ext/gdb-xml/riscv.xml To add support for ...

Generated on Tue Jun 18 2024 16:23:59 for gem5 by doxygen 1.11.0