remote_gdb.hh revision 13612
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__ 38146SN/A 392SN/A#include <string> 402SN/A 412158SN/A#include "arch/riscv/registers.hh" 42146SN/A#include "base/remote_gdb.hh" 431805SN/A 44146SN/Aclass System; 451717SN/Aclass ThreadContext; 462680SN/A 478232Snate@binkert.orgnamespace RiscvISA 485480Snate@binkert.org{ 498741Sgblack@eecs.umich.edu 508741Sgblack@eecs.umich.educlass RemoteGDB : public BaseRemoteGDB 518741Sgblack@eecs.umich.edu{ 522521SN/A protected: 5356SN/A static const int ExplicitCSRs = 4; 545478SN/A 553348SN/A bool acc(Addr addr, size_t len); 563348SN/A 572521SN/A class RiscvGdbRegCache : public BaseGdbRegCache 585480Snate@binkert.org { 591805SN/A using BaseGdbRegCache::BaseGdbRegCache; 602SN/A private: 612SN/A struct { 622107SN/A uint64_t gpr[NumIntArchRegs]; 632SN/A uint64_t pc; 645480Snate@binkert.org uint64_t fpr[NumFloatRegs]; 659808Sstever@gmail.com 669808Sstever@gmail.com uint64_t csr_base; 678806Sgblack@eecs.umich.edu uint32_t fflags; 682SN/A uint32_t frm; 692521SN/A uint32_t fcsr; 702521SN/A uint64_t csr[NumMiscRegs - ExplicitCSRs]; 712SN/A } __attribute__((__packed__)) r; 722SN/A public: 732SN/A char *data() const { return (char *)&r; } 74926SN/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 { 814395SN/A return gdb->name() + ".RiscvGdbRegCache"; 821805SN/A } 832SN/A }; 842SN/A 851634SN/A RiscvGdbRegCache regCache; 865480Snate@binkert.org 871634SN/A public: 882549SN/A RemoteGDB(System *_system, ThreadContext *tc, int _port); 895714Shsul@eecs.umich.edu BaseGdbRegCache *gdbRegs(); 901634SN/A}; 911634SN/A 921634SN/A} // namespace RiscvISA 938931Sandreas.hansson@arm.com 941634SN/A#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */ 958741Sgblack@eecs.umich.edu