remote_gdb.hh revision 11963
12SN/A/* 21762SN/A * Copyright (c) 2017 The University of Virginia 32SN/A * Copyright 2015 LabWare 42SN/A * Copyright 2014 Google, Inc. 52SN/A * Copyright (c) 2007 The Regents of The University of Michigan 62SN/A * All rights reserved. 72SN/A * 82SN/A * Redistribution and use in source and binary forms, with or without 92SN/A * modification, are permitted provided that the following conditions are 102SN/A * met: redistributions of source code must retain the above copyright 112SN/A * notice, this list of conditions and the following disclaimer; 122SN/A * redistributions in binary form must reproduce the above copyright 132SN/A * notice, this list of conditions and the following disclaimer in the 142SN/A * documentation and/or other materials provided with the distribution; 152SN/A * neither the name of the copyright holders nor the names of its 162SN/A * contributors may be used to endorse or promote products derived from 172SN/A * this software without specific prior written permission. 182SN/A * 192SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 202SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 212SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 222SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 232SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 242SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 252SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 262SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 272665SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 282665SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 292665SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 302665SN/A * 312665SN/A * Authors: Nathan Binkert 322SN/A * Boris Shingarov 332SN/A * Alec Roelke 341722SN/A */ 355480Snate@binkert.org 362SN/A#ifndef __ARCH_RISCV_REMOTE_GDB_HH__ 372SN/A#define __ARCH_RISCV_REMOTE_GDB_HH__ 3811793Sbrandon.potter@amd.com 3911793Sbrandon.potter@amd.com#include <string> 40146SN/A 412SN/A#include "arch/riscv/registers.hh" 422SN/A#include "base/remote_gdb.hh" 432158SN/A 44146SN/Aclass System; 451805SN/Aclass ThreadContext; 46146SN/A 471717SN/Anamespace RiscvISA 482680SN/A{ 498232Snate@binkert.org 508741Sgblack@eecs.umich.educlass RemoteGDB : public BaseRemoteGDB 518741Sgblack@eecs.umich.edu{ 528741Sgblack@eecs.umich.edu protected: 532521SN/A static const int ExplicitCSRs = 4; 5411264Sandreas.sandberg@arm.com 5512239Sandreas.sandberg@arm.com bool acc(Addr addr, size_t len); 563348SN/A 573348SN/A class RiscvGdbRegCache : public BaseGdbRegCache 582521SN/A { 595480Snate@binkert.org using BaseGdbRegCache::BaseGdbRegCache; 601805SN/A private: 612SN/A struct { 622SN/A IntReg gpr[NumIntArchRegs]; 632107SN/A IntReg pc; 642SN/A FloatRegBits fpr[NumFloatRegs]; 655480Snate@binkert.org 669808Sstever@gmail.com MiscReg csr_base; 679808Sstever@gmail.com uint32_t fflags; 688806Sgblack@eecs.umich.edu uint32_t frm; 692SN/A uint32_t fcsr; 702521SN/A MiscReg csr[NumMiscRegs - ExplicitCSRs]; 712521SN/A } __attribute__((__packed__)) r; 722SN/A public: 732SN/A char *data() const { return (char *)&r; } 742SN/A size_t size() const { return sizeof(r); } 75926SN/A void getRegs(ThreadContext*); 76926SN/A void setRegs(ThreadContext*) const; 77926SN/A 78926SN/A const std::string 79926SN/A name() const 80926SN/A { 81926SN/A return gdb->name() + ".RiscvGdbRegCache"; 824395SN/A } 831805SN/A }; 842SN/A 852SN/A 861634SN/A public: 875480Snate@binkert.org RemoteGDB(System *_system, ThreadContext *tc); 881634SN/A BaseGdbRegCache *gdbRegs(); 892549SN/A}; 905714Shsul@eecs.umich.edu 911634SN/A} // namespace RiscvISA 921634SN/A 931634SN/A#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */ 948931Sandreas.hansson@arm.com