remote_gdb.hh (10804:df2aa91dba5b) remote_gdb.hh (11274:d9a0136ab8cc)
1/*
1/*
2 * Copyright 2015 LabWare
2 * Copyright 2014 Google, Inc.
3 * Copyright (c) 2013 ARM Limited
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software

--- 26 unchanged lines hidden (view full) ---

36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * Authors: Nathan Binkert
43 * Stephen Hines
3 * Copyright 2014 Google, Inc.
4 * Copyright (c) 2013 ARM Limited
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

--- 26 unchanged lines hidden (view full) ---

37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 * Authors: Nathan Binkert
44 * Stephen Hines
45 * Boris Shingarov
44 */
45
46#ifndef __ARCH_ARM_REMOTE_GDB_HH__
47#define __ARCH_ARM_REMOTE_GDB_HH__
48
49#include <algorithm>
50
46 */
47
48#ifndef __ARCH_ARM_REMOTE_GDB_HH__
49#define __ARCH_ARM_REMOTE_GDB_HH__
50
51#include <algorithm>
52
53#include "arch/arm/utility.hh"
51#include "base/remote_gdb.hh"
52
53class System;
54class ThreadContext;
55
56namespace ArmISA
57{
58
54#include "base/remote_gdb.hh"
55
56class System;
57class ThreadContext;
58
59namespace ArmISA
60{
61
59// AArch32 registers with vfpv3/neon
60enum {
61 GDB32_R0 = 0,
62 GDB32_CPSR = 16,
63 GDB32_F0 = 17,
64 GDB32_FPSCR = 81,
65 GDB32_NUMREGS = 82
66};
67
68// AArch64 registers
69enum {
70 GDB64_X0 = 0,
71 GDB64_SPX = 31,
72 GDB64_PC = 32,
73 GDB64_CPSR = 33,
74 GDB64_V0 = 34,
75 GDB64_V0_32 = 2 * GDB64_V0,
76 GDB64_NUMREGS = 98
77};
78
79const int GDB_REG_BYTES M5_VAR_USED =
80 std::max(GDB64_NUMREGS * sizeof(uint64_t),
81 GDB32_NUMREGS * sizeof(uint32_t));
82
83class RemoteGDB : public BaseRemoteGDB
84{
85 protected:
86 bool acc(Addr addr, size_t len);
62class RemoteGDB : public BaseRemoteGDB
63{
64 protected:
65 bool acc(Addr addr, size_t len);
87 bool write(Addr addr, size_t size, const char *data);
88
66
89 void getregs();
90 void setregs();
67 class AArch32GdbRegCache : public BaseGdbRegCache
68 {
69 using BaseGdbRegCache::BaseGdbRegCache;
70 private:
71 struct {
72 uint32_t gpr[16];
73 uint32_t fpr[8*3];
74 uint32_t fpscr;
75 uint32_t cpsr;
76 } r;
77 public:
78 char *data() const { return (char *)&r; }
79 size_t size() const { return sizeof(r); }
80 void getRegs(ThreadContext*);
81 void setRegs(ThreadContext*) const;
82 const std::string name() const { return gdb->name() + ".AArch32GdbRegCache"; }
83 };
91
84
85 class AArch64GdbRegCache : public BaseGdbRegCache
86 {
87 using BaseGdbRegCache::BaseGdbRegCache;
88 private:
89 struct {
90 uint64_t x[31];
91 uint64_t spx;
92 uint64_t pc;
93 uint64_t cpsr;
94 uint32_t v[32*4];
95 } r;
96 public:
97 char *data() const { return (char *)&r; }
98 size_t size() const { return sizeof(r); }
99 void getRegs(ThreadContext*);
100 void setRegs(ThreadContext*) const;
101 const std::string name() const { return gdb->name() + ".AArch64GdbRegCache"; }
102 };
103
92 public:
93 RemoteGDB(System *_system, ThreadContext *tc);
104 public:
105 RemoteGDB(System *_system, ThreadContext *tc);
106 BaseGdbRegCache *gdbRegs();
94};
95} // namespace ArmISA
96
97#endif /* __ARCH_ARM_REMOTE_GDB_H__ */
107};
108} // namespace ArmISA
109
110#endif /* __ARCH_ARM_REMOTE_GDB_H__ */