remote_gdb.hh revision 11274:d9a0136ab8cc
17008Snate@binkert.org/*
210524Snilay@cs.wisc.edu * Copyright 2015 LabWare
37008Snate@binkert.org * Copyright 2014 Google, Inc.
47008Snate@binkert.org * Copyright (c) 2007 The Regents of The University of Michigan
57008Snate@binkert.org * All rights reserved.
67008Snate@binkert.org *
77008Snate@binkert.org * Redistribution and use in source and binary forms, with or without
87008Snate@binkert.org * modification, are permitted provided that the following conditions are
97008Snate@binkert.org * met: redistributions of source code must retain the above copyright
107008Snate@binkert.org * notice, this list of conditions and the following disclaimer;
117008Snate@binkert.org * redistributions in binary form must reproduce the above copyright
127008Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
137008Snate@binkert.org * documentation and/or other materials provided with the distribution;
147008Snate@binkert.org * neither the name of the copyright holders nor the names of its
157008Snate@binkert.org * contributors may be used to endorse or promote products derived from
167008Snate@binkert.org * this software without specific prior written permission.
177008Snate@binkert.org *
187008Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
197008Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
207008Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
217008Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
227008Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
237008Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
247008Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
257008Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
267008Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
277008Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
286285Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
297039Snate@binkert.org *
307039Snate@binkert.org * Authors: Nathan Binkert
316285Snate@binkert.org *          Boris Shingarov
3210963Sdavid.hashe@amd.com */
337055Snate@binkert.org
347055Snate@binkert.org#ifndef __ARCH_MIPS_REMOTE_GDB_HH__
356876Ssteve.reinhardt@amd.com#define __ARCH_MIPS_REMOTE_GDB_HH__
369745Snilay@cs.wisc.edu
378341Snilay@cs.wisc.edu#include "arch/mips/registers.hh"
386506Spdudnik@gmail.com#include "base/bitfield.hh"
397055Snate@binkert.org#include "base/remote_gdb.hh"
408436SBrad.Beckmann@amd.com
419497Snilay@cs.wisc.educlass System;
4210301Snilay@cs.wisc.educlass ThreadContext;
4310301Snilay@cs.wisc.edu
446881SBrad.Beckmann@amd.comnamespace MipsISA
4510301Snilay@cs.wisc.edu{
469364Snilay@cs.wisc.edu
4710524Snilay@cs.wisc.educlass RemoteGDB : public BaseRemoteGDB
487055Snate@binkert.org{
4910524Snilay@cs.wisc.edu  protected:
506285Snate@binkert.org    bool acc(Addr addr, size_t len);
516285Snate@binkert.org
526285Snate@binkert.org    class MipsGdbRegCache : public BaseGdbRegCache
5310963Sdavid.hashe@amd.com    {
5410963Sdavid.hashe@amd.com      using BaseGdbRegCache::BaseGdbRegCache;
5510963Sdavid.hashe@amd.com      private:
5610963Sdavid.hashe@amd.com        struct {
5710963Sdavid.hashe@amd.com            uint32_t gpr[32];
5810963Sdavid.hashe@amd.com            uint32_t sr;
5910963Sdavid.hashe@amd.com            uint32_t lo;
6010524Snilay@cs.wisc.edu            uint32_t hi;
617039Snate@binkert.org            uint32_t badvaddr;
627039Snate@binkert.org            uint32_t cause;
636876Ssteve.reinhardt@amd.com            uint32_t pc;
648436SBrad.Beckmann@amd.com            uint32_t fpr[32];
659496Snilay@cs.wisc.edu            uint32_t fsr;
668257SBrad.Beckmann@amd.com            uint32_t fir;
679745Snilay@cs.wisc.edu        } r;
6810078Snilay@cs.wisc.edu      public:
6910078Snilay@cs.wisc.edu        char *data() const { return (char *)&r; }
7010078Snilay@cs.wisc.edu        size_t size() const { return sizeof(r); }
719819Snilay@cs.wisc.edu        void getRegs(ThreadContext*);
729819Snilay@cs.wisc.edu        void setRegs(ThreadContext*) const;
739819Snilay@cs.wisc.edu        const std::string name() const { return gdb->name() + ".MipsGdbRegCache"; }
7411025Snilay@cs.wisc.edu    };
7511025Snilay@cs.wisc.edu
769819Snilay@cs.wisc.edu
777039Snate@binkert.org  public:
7811021Sjthestness@gmail.com    RemoteGDB(System *_system, ThreadContext *tc);
7911025Snilay@cs.wisc.edu    BaseGdbRegCache *gdbRegs();
806285Snate@binkert.org};
817055Snate@binkert.org
827039Snate@binkert.org} // namespace MipsISA
8310012Snilay@cs.wisc.edu
8410012Snilay@cs.wisc.edu#endif /* __ARCH_MIPS_REMOTE_GDB_H__ */
859745Snilay@cs.wisc.edu