remote_gdb.hh revision 11963:3fb6bb58e6a4
12381SN/A/* 22381SN/A * Copyright (c) 2017 The University of Virginia 32381SN/A * Copyright 2015 LabWare 42381SN/A * Copyright 2014 Google, Inc. 52381SN/A * Copyright (c) 2007 The Regents of The University of Michigan 62381SN/A * All rights reserved. 72381SN/A * 82381SN/A * Redistribution and use in source and binary forms, with or without 92381SN/A * modification, are permitted provided that the following conditions are 102381SN/A * met: redistributions of source code must retain the above copyright 112381SN/A * notice, this list of conditions and the following disclaimer; 122381SN/A * redistributions in binary form must reproduce the above copyright 132381SN/A * notice, this list of conditions and the following disclaimer in the 142381SN/A * documentation and/or other materials provided with the distribution; 152381SN/A * neither the name of the copyright holders nor the names of its 162381SN/A * contributors may be used to endorse or promote products derived from 172381SN/A * this software without specific prior written permission. 182381SN/A * 192381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 202381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 212381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 222381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 232381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 242381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 252381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 262381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 272381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 282381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 292381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 302381SN/A * 312381SN/A * Authors: Nathan Binkert 322381SN/A * Boris Shingarov 332381SN/A * Alec Roelke 342381SN/A */ 352381SN/A 362381SN/A#ifndef __ARCH_RISCV_REMOTE_GDB_HH__ 372381SN/A#define __ARCH_RISCV_REMOTE_GDB_HH__ 382381SN/A 392381SN/A#include <string> 402381SN/A 412381SN/A#include "arch/riscv/registers.hh" 422381SN/A#include "base/remote_gdb.hh" 432381SN/A 442439SN/Aclass System; 452381SN/Aclass ThreadContext; 462381SN/A 472381SN/Anamespace RiscvISA 482381SN/A{ 492407SN/A 502407SN/Aclass RemoteGDB : public BaseRemoteGDB 512407SN/A{ 522407SN/A protected: 532407SN/A static const int ExplicitCSRs = 4; 542407SN/A 552407SN/A bool acc(Addr addr, size_t len); 562407SN/A 572521SN/A class RiscvGdbRegCache : public BaseGdbRegCache 582407SN/A { 592381SN/A using BaseGdbRegCache::BaseGdbRegCache; 602381SN/A private: 612381SN/A struct { 622381SN/A IntReg gpr[NumIntArchRegs]; 632381SN/A IntReg pc; 642381SN/A FloatRegBits fpr[NumFloatRegs]; 652381SN/A 662381SN/A MiscReg csr_base; 672381SN/A uint32_t fflags; 682381SN/A uint32_t frm; 692381SN/A uint32_t fcsr; 702381SN/A MiscReg csr[NumMiscRegs - ExplicitCSRs]; 712381SN/A } __attribute__((__packed__)) r; 722640Sstever@eecs.umich.edu public: 732640Sstever@eecs.umich.edu char *data() const { return (char *)&r; } 742640Sstever@eecs.umich.edu size_t size() const { return sizeof(r); } 752640Sstever@eecs.umich.edu void getRegs(ThreadContext*); 762640Sstever@eecs.umich.edu void setRegs(ThreadContext*) const; 772661Sstever@eecs.umich.edu 782661Sstever@eecs.umich.edu const std::string 792661Sstever@eecs.umich.edu name() const 802661Sstever@eecs.umich.edu { 812661Sstever@eecs.umich.edu return gdb->name() + ".RiscvGdbRegCache"; 822381SN/A } 832381SN/A }; 842640Sstever@eecs.umich.edu 852640Sstever@eecs.umich.edu 862640Sstever@eecs.umich.edu public: 872640Sstever@eecs.umich.edu RemoteGDB(System *_system, ThreadContext *tc); 882640Sstever@eecs.umich.edu BaseGdbRegCache *gdbRegs(); 892640Sstever@eecs.umich.edu}; 902640Sstever@eecs.umich.edu 912661Sstever@eecs.umich.edu} // namespace RiscvISA 922640Sstever@eecs.umich.edu 932640Sstever@eecs.umich.edu#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */ 942640Sstever@eecs.umich.edu