gem5  v22.1.0.0
remote_gdb.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015 LabWare
3  * Copyright 2014 Google, Inc.
4  * Copyright (c) 2007 The Hewlett-Packard Development Company
5  * All rights reserved.
6  *
7  * The license below extends only to copyright in the software and shall
8  * not be construed as granting a license to any other intellectual
9  * property including but not limited to intellectual property relating
10  * to a hardware implementation of the functionality of the software
11  * licensed hereunder. You may use the software subject to the license
12  * terms below provided that you ensure that this notice is replicated
13  * unmodified and in its entirety in all distributions of the software,
14  * modified or unmodified, in source code or in binary form.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions are
18  * met: redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer;
20  * redistributions in binary form must reproduce the above copyright
21  * notice, this list of conditions and the following disclaimer in the
22  * documentation and/or other materials provided with the distribution;
23  * neither the name of the copyright holders nor the names of its
24  * contributors may be used to endorse or promote products derived from
25  * this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 #ifndef __ARCH_X86_REMOTEGDB_HH__
41 #define __ARCH_X86_REMOTEGDB_HH__
42 
43 #include <algorithm>
44 
45 #include "arch/x86/types.hh"
46 #include "base/compiler.hh"
47 #include "base/remote_gdb.hh"
48 
49 namespace gem5
50 {
51 
52 class System;
53 class ThreadContext;
54 
55 namespace X86ISA
56 {
57 class RemoteGDB : public BaseRemoteGDB
58 {
59  protected:
60  bool acc(Addr addr, size_t len);
61  bool checkBpKind(size_t kind) { return kind == 1; }
63  {
65  private:
66  struct
67  {
68  uint32_t eax;
69  uint32_t ecx;
70  uint32_t edx;
71  uint32_t ebx;
72  uint32_t esp;
73  uint32_t ebp;
74  uint32_t esi;
75  uint32_t edi;
76  uint32_t eip;
77  uint32_t eflags;
78  uint32_t cs;
79  uint32_t ss;
80  uint32_t ds;
81  uint32_t es;
82  uint32_t fs;
83  uint32_t gs;
84  } r;
85  public:
86  char *data() const { return (char *)&r; }
87  size_t size() const { return sizeof(r); }
88  void getRegs(ThreadContext*);
89  void setRegs(ThreadContext*) const;
90  const std::string
91  name() const
92  {
93  return gdb->name() + ".X86GdbRegCache";
94  }
95  };
96 
98  {
100  private:
101  struct GEM5_PACKED
102  {
103  uint64_t rax;
104  uint64_t rbx;
105  uint64_t rcx;
106  uint64_t rdx;
107  uint64_t rsi;
108  uint64_t rdi;
109  uint64_t rbp;
110  uint64_t rsp;
111  uint64_t r8;
112  uint64_t r9;
113  uint64_t r10;
114  uint64_t r11;
115  uint64_t r12;
116  uint64_t r13;
117  uint64_t r14;
118  uint64_t r15;
119  uint64_t rip;
120  uint32_t eflags;
121  uint32_t cs;
122  uint32_t ss;
123  uint32_t ds;
124  uint32_t es;
125  uint32_t fs;
126  uint32_t gs;
127  /*
128  * We do not model st[], FPU status regs, xmm[] etc.
129  * While it's not ok to have G-packets larger than what gdb
130  * knows about, it is ok to have smaller ones.
131  */
132  } r;
133  public:
134  char *data() const { return (char *)&r; }
135  size_t size() const { return sizeof(r); }
136  void getRegs(ThreadContext*);
137  void setRegs(ThreadContext*) const;
138  const std::string
139  name() const
140  {
141  return gdb->name() + ".AMD64GdbRegCache";
142  }
143  };
144 
147 
148  public:
151 };
152 
153 } // namespace X86ISA
154 } // namespace gem5
155 
156 #endif // __ARCH_X86_REMOTEGDB_HH__
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
Definition: remote_gdb.hh:86
BaseRemoteGDB * gdb
Definition: remote_gdb.hh:140
ThreadContext is the external interface to all thread state for anything outside of the CPU.
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
Definition: remote_gdb.hh:134
const std::string name() const
Return the name to use in places like DPRINTF.
Definition: remote_gdb.hh:139
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
Definition: remote_gdb.cc:125
struct gem5::X86ISA::RemoteGDB::AMD64GdbRegCache::GEM5_PACKED r
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
Definition: remote_gdb.cc:177
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).
Definition: remote_gdb.hh:135
struct gem5::X86ISA::RemoteGDB::X86GdbRegCache::@32 r
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
Definition: remote_gdb.cc:155
const std::string name() const
Return the name to use in places like DPRINTF.
Definition: remote_gdb.hh:91
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
Definition: remote_gdb.cc:213
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
Definition: remote_gdb.hh:86
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).
Definition: remote_gdb.hh:87
RemoteGDB(System *system, int _port)
bool acc(Addr addr, size_t len)
AMD64GdbRegCache regCache64
Definition: remote_gdb.hh:146
BaseGdbRegCache * gdbRegs()
X86GdbRegCache regCache32
Definition: remote_gdb.hh:145
bool checkBpKind(size_t kind)
Definition: remote_gdb.hh:61
BaseGdbRegCache(BaseRemoteGDB *g)
Definition: remote_gdb.hh:134
std::string name()
Definition: remote_gdb.cc:407
uint16_t len
Definition: helpers.cc:62
Bitfield< 3 > addr
Definition: types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147

Generated on Wed Dec 21 2022 10:22:25 for gem5 by doxygen 1.9.1