remote_gdb.hh revision 12031
16019Shines@cs.fsu.edu/*
211274Sshingarov@labware.com * Copyright 2015 LabWare
310595Sgabeblack@google.com * Copyright 2014 Google, Inc.
410037SARM gem5 Developers * Copyright (c) 2013 ARM Limited
510037SARM gem5 Developers * All rights reserved
610037SARM gem5 Developers *
710037SARM gem5 Developers * The license below extends only to copyright in the software and shall
810037SARM gem5 Developers * not be construed as granting a license to any other intellectual
910037SARM gem5 Developers * property including but not limited to intellectual property relating
1010037SARM gem5 Developers * to a hardware implementation of the functionality of the software
1110037SARM gem5 Developers * licensed hereunder.  You may use the software subject to the license
1210037SARM gem5 Developers * terms below provided that you ensure that this notice is replicated
1310037SARM gem5 Developers * unmodified and in its entirety in all distributions of the software,
1410037SARM gem5 Developers * modified or unmodified, in source code or in binary form.
1510037SARM gem5 Developers *
166019Shines@cs.fsu.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan
176019Shines@cs.fsu.edu * Copyright (c) 2007-2008 The Florida State University
186019Shines@cs.fsu.edu * All rights reserved.
196019Shines@cs.fsu.edu *
206019Shines@cs.fsu.edu * Redistribution and use in source and binary forms, with or without
216019Shines@cs.fsu.edu * modification, are permitted provided that the following conditions are
226019Shines@cs.fsu.edu * met: redistributions of source code must retain the above copyright
236019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer;
246019Shines@cs.fsu.edu * redistributions in binary form must reproduce the above copyright
256019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer in the
266019Shines@cs.fsu.edu * documentation and/or other materials provided with the distribution;
276019Shines@cs.fsu.edu * neither the name of the copyright holders nor the names of its
286019Shines@cs.fsu.edu * contributors may be used to endorse or promote products derived from
296019Shines@cs.fsu.edu * this software without specific prior written permission.
306019Shines@cs.fsu.edu *
316019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
326019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
346019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
356019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
366019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
376019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
386019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
396019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
406019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
416019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
426019Shines@cs.fsu.edu *
436019Shines@cs.fsu.edu * Authors: Nathan Binkert
446019Shines@cs.fsu.edu *          Stephen Hines
4511274Sshingarov@labware.com *          Boris Shingarov
466019Shines@cs.fsu.edu */
476019Shines@cs.fsu.edu
486019Shines@cs.fsu.edu#ifndef __ARCH_ARM_REMOTE_GDB_HH__
496019Shines@cs.fsu.edu#define __ARCH_ARM_REMOTE_GDB_HH__
506019Shines@cs.fsu.edu
5110595Sgabeblack@google.com#include <algorithm>
5210595Sgabeblack@google.com
5311274Sshingarov@labware.com#include "arch/arm/utility.hh"
546019Shines@cs.fsu.edu#include "base/remote_gdb.hh"
556019Shines@cs.fsu.edu
567752SWilliam.Wang@arm.comclass System;
577752SWilliam.Wang@arm.comclass ThreadContext;
587752SWilliam.Wang@arm.com
596019Shines@cs.fsu.edunamespace ArmISA
606019Shines@cs.fsu.edu{
6110037SARM gem5 Developers
627752SWilliam.Wang@arm.comclass RemoteGDB : public BaseRemoteGDB
637752SWilliam.Wang@arm.com{
6410601Sgabeblack@google.com  protected:
6510601Sgabeblack@google.com    bool acc(Addr addr, size_t len);
666019Shines@cs.fsu.edu
6711274Sshingarov@labware.com    class AArch32GdbRegCache : public BaseGdbRegCache
6811274Sshingarov@labware.com    {
6911274Sshingarov@labware.com      using BaseGdbRegCache::BaseGdbRegCache;
7011274Sshingarov@labware.com      private:
7111274Sshingarov@labware.com        struct {
7211274Sshingarov@labware.com          uint32_t gpr[16];
7311274Sshingarov@labware.com          uint32_t fpr[8*3];
7411274Sshingarov@labware.com          uint32_t fpscr;
7511274Sshingarov@labware.com          uint32_t cpsr;
7611274Sshingarov@labware.com        } r;
7711274Sshingarov@labware.com      public:
7811274Sshingarov@labware.com        char *data() const { return (char *)&r; }
7911274Sshingarov@labware.com        size_t size() const { return sizeof(r); }
8011274Sshingarov@labware.com        void getRegs(ThreadContext*);
8111274Sshingarov@labware.com        void setRegs(ThreadContext*) const;
8212031Sgabeblack@google.com        const std::string
8312031Sgabeblack@google.com        name() const
8412031Sgabeblack@google.com        {
8512031Sgabeblack@google.com            return gdb->name() + ".AArch32GdbRegCache";
8612031Sgabeblack@google.com        }
8711274Sshingarov@labware.com    };
8811274Sshingarov@labware.com
8911274Sshingarov@labware.com    class AArch64GdbRegCache : public BaseGdbRegCache
9011274Sshingarov@labware.com    {
9111274Sshingarov@labware.com      using BaseGdbRegCache::BaseGdbRegCache;
9211274Sshingarov@labware.com      private:
9311274Sshingarov@labware.com        struct {
9411274Sshingarov@labware.com          uint64_t x[31];
9511274Sshingarov@labware.com          uint64_t spx;
9611274Sshingarov@labware.com          uint64_t pc;
9711274Sshingarov@labware.com          uint64_t cpsr;
9811274Sshingarov@labware.com          uint32_t v[32*4];
9911274Sshingarov@labware.com        } r;
10011274Sshingarov@labware.com      public:
10111274Sshingarov@labware.com        char *data() const { return (char *)&r; }
10211274Sshingarov@labware.com        size_t size() const { return sizeof(r); }
10311274Sshingarov@labware.com        void getRegs(ThreadContext*);
10411274Sshingarov@labware.com        void setRegs(ThreadContext*) const;
10512031Sgabeblack@google.com        const std::string
10612031Sgabeblack@google.com        name() const
10712031Sgabeblack@google.com        {
10812031Sgabeblack@google.com            return gdb->name() + ".AArch64GdbRegCache";
10912031Sgabeblack@google.com        }
11011274Sshingarov@labware.com    };
1116019Shines@cs.fsu.edu
11212031Sgabeblack@google.com    AArch32GdbRegCache regCache32;
11312031Sgabeblack@google.com    AArch64GdbRegCache regCache64;
11412031Sgabeblack@google.com
11510601Sgabeblack@google.com  public:
11610601Sgabeblack@google.com    RemoteGDB(System *_system, ThreadContext *tc);
11711274Sshingarov@labware.com    BaseGdbRegCache *gdbRegs();
1187752SWilliam.Wang@arm.com};
1197752SWilliam.Wang@arm.com} // namespace ArmISA
1206019Shines@cs.fsu.edu
1216019Shines@cs.fsu.edu#endif /* __ARCH_ARM_REMOTE_GDB_H__ */
122