remote_gdb.hh revision 11963:3fb6bb58e6a4
16791SN/A/*
26791SN/A * Copyright (c) 2017 The University of Virginia
36791SN/A * Copyright 2015 LabWare
46791SN/A * Copyright 2014 Google, Inc.
56791SN/A * Copyright (c) 2007 The Regents of The University of Michigan
66791SN/A * All rights reserved.
76791SN/A *
86791SN/A * Redistribution and use in source and binary forms, with or without
96791SN/A * modification, are permitted provided that the following conditions are
106791SN/A * met: redistributions of source code must retain the above copyright
116791SN/A * notice, this list of conditions and the following disclaimer;
126791SN/A * redistributions in binary form must reproduce the above copyright
136791SN/A * notice, this list of conditions and the following disclaimer in the
146791SN/A * documentation and/or other materials provided with the distribution;
156791SN/A * neither the name of the copyright holders nor the names of its
166791SN/A * contributors may be used to endorse or promote products derived from
176791SN/A * this software without specific prior written permission.
186791SN/A *
196791SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
206791SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
216791SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
226791SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
236791SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
246791SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
256791SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
266791SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
276791SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
286791SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2910441Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3010441Snilay@cs.wisc.edu *
316791SN/A * Authors: Nathan Binkert
327055SN/A *          Boris Shingarov
3311168Sandreas.hansson@arm.com *          Alec Roelke
347055SN/A */
357039SN/A
3610301Snilay@cs.wisc.edu#ifndef __ARCH_RISCV_REMOTE_GDB_HH__
377039SN/A#define __ARCH_RISCV_REMOTE_GDB_HH__
3814184Sgabeblack@google.com
396791SN/A#include <string>
407039SN/A
417039SN/A#include "arch/riscv/registers.hh"
427039SN/A#include "base/remote_gdb.hh"
438607SN/A
447055SN/Aclass System;
456791SN/Aclass ThreadContext;
467039SN/A
477039SN/Anamespace RiscvISA
487039SN/A{
496797SN/A
506791SN/Aclass RemoteGDB : public BaseRemoteGDB
517039SN/A{
527039SN/A  protected:
537039SN/A    static const int ExplicitCSRs = 4;
547039SN/A
557039SN/A    bool acc(Addr addr, size_t len);
566791SN/A
577039SN/A    class RiscvGdbRegCache : public BaseGdbRegCache
587039SN/A    {
597054SN/A      using BaseGdbRegCache::BaseGdbRegCache;
607039SN/A      private:
6111025Snilay@cs.wisc.edu        struct {
627039SN/A            IntReg gpr[NumIntArchRegs];
6311025Snilay@cs.wisc.edu            IntReg pc;
6411025Snilay@cs.wisc.edu            FloatRegBits fpr[NumFloatRegs];
6511025Snilay@cs.wisc.edu
6611025Snilay@cs.wisc.edu            MiscReg csr_base;
6711025Snilay@cs.wisc.edu            uint32_t fflags;
6811025Snilay@cs.wisc.edu            uint32_t frm;
6911025Snilay@cs.wisc.edu            uint32_t fcsr;
7011025Snilay@cs.wisc.edu            MiscReg csr[NumMiscRegs - ExplicitCSRs];
716791SN/A        } __attribute__((__packed__)) r;
727055SN/A      public:
736791SN/A        char *data() const { return (char *)&r; }
747039SN/A        size_t size() const { return sizeof(r); }
757039SN/A        void getRegs(ThreadContext*);
767039SN/A        void setRegs(ThreadContext*) const;
777039SN/A
786791SN/A        const std::string
797039SN/A        name() const
8011168Sandreas.hansson@arm.com        {
817455SN/A            return gdb->name() + ".RiscvGdbRegCache";
826791SN/A        }
836791SN/A    };
847055SN/A
857055SN/A
866791SN/A  public:
877039SN/A    RemoteGDB(System *_system, ThreadContext *tc);
887055SN/A    BaseGdbRegCache *gdbRegs();
897039SN/A};
906791SN/A
916791SN/A} // namespace RiscvISA
927055SN/A
937055SN/A#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */
946797SN/A