16019Shines@cs.fsu.edu/* 211274Sshingarov@labware.com * Copyright 2015 LabWare 310595Sgabeblack@google.com * Copyright 2014 Google, Inc. 414238Sciro.santilli@arm.com * Copyright (c) 2013, 2016, 2018-2019 ARM Limited 510037SARM gem5 Developers * All rights reserved 610037SARM gem5 Developers * 710037SARM gem5 Developers * The license below extends only to copyright in the software and shall 810037SARM gem5 Developers * not be construed as granting a license to any other intellectual 910037SARM gem5 Developers * property including but not limited to intellectual property relating 1010037SARM gem5 Developers * to a hardware implementation of the functionality of the software 1110037SARM gem5 Developers * licensed hereunder. You may use the software subject to the license 1210037SARM gem5 Developers * terms below provided that you ensure that this notice is replicated 1310037SARM gem5 Developers * unmodified and in its entirety in all distributions of the software, 1410037SARM gem5 Developers * modified or unmodified, in source code or in binary form. 1510037SARM gem5 Developers * 166019Shines@cs.fsu.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan 176019Shines@cs.fsu.edu * Copyright (c) 2007-2008 The Florida State University 186019Shines@cs.fsu.edu * All rights reserved. 196019Shines@cs.fsu.edu * 206019Shines@cs.fsu.edu * Redistribution and use in source and binary forms, with or without 216019Shines@cs.fsu.edu * modification, are permitted provided that the following conditions are 226019Shines@cs.fsu.edu * met: redistributions of source code must retain the above copyright 236019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer; 246019Shines@cs.fsu.edu * redistributions in binary form must reproduce the above copyright 256019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer in the 266019Shines@cs.fsu.edu * documentation and/or other materials provided with the distribution; 276019Shines@cs.fsu.edu * neither the name of the copyright holders nor the names of its 286019Shines@cs.fsu.edu * contributors may be used to endorse or promote products derived from 296019Shines@cs.fsu.edu * this software without specific prior written permission. 306019Shines@cs.fsu.edu * 316019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 326019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 336019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 346019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 356019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 366019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 376019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 386019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 396019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 406019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 416019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 426019Shines@cs.fsu.edu * 436019Shines@cs.fsu.edu * Authors: Nathan Binkert 446019Shines@cs.fsu.edu * Stephen Hines 4511274Sshingarov@labware.com * Boris Shingarov 466019Shines@cs.fsu.edu */ 476019Shines@cs.fsu.edu 486019Shines@cs.fsu.edu#ifndef __ARCH_ARM_REMOTE_GDB_HH__ 496019Shines@cs.fsu.edu#define __ARCH_ARM_REMOTE_GDB_HH__ 506019Shines@cs.fsu.edu 5110595Sgabeblack@google.com#include <algorithm> 5210595Sgabeblack@google.com 5313579Sciro.santilli@arm.com#include "arch/arm/registers.hh" 5411274Sshingarov@labware.com#include "arch/arm/utility.hh" 5513468Sciro.santilli@arm.com#include "base/compiler.hh" 566019Shines@cs.fsu.edu#include "base/remote_gdb.hh" 576019Shines@cs.fsu.edu 587752SWilliam.Wang@arm.comclass System; 597752SWilliam.Wang@arm.comclass ThreadContext; 607752SWilliam.Wang@arm.com 616019Shines@cs.fsu.edunamespace ArmISA 626019Shines@cs.fsu.edu{ 6310037SARM gem5 Developers 647752SWilliam.Wang@arm.comclass RemoteGDB : public BaseRemoteGDB 657752SWilliam.Wang@arm.com{ 6610601Sgabeblack@google.com protected: 6710601Sgabeblack@google.com bool acc(Addr addr, size_t len); 686019Shines@cs.fsu.edu 6911274Sshingarov@labware.com class AArch32GdbRegCache : public BaseGdbRegCache 7011274Sshingarov@labware.com { 7111274Sshingarov@labware.com using BaseGdbRegCache::BaseGdbRegCache; 7211274Sshingarov@labware.com private: 7311274Sshingarov@labware.com struct { 7411274Sshingarov@labware.com uint32_t gpr[16]; 7513579Sciro.santilli@arm.com uint32_t cpsr; 7613579Sciro.santilli@arm.com uint64_t fpr[32]; 7711274Sshingarov@labware.com uint32_t fpscr; 7813468Sciro.santilli@arm.com } M5_ATTR_PACKED r; 7911274Sshingarov@labware.com public: 8011274Sshingarov@labware.com char *data() const { return (char *)&r; } 8111274Sshingarov@labware.com size_t size() const { return sizeof(r); } 8211274Sshingarov@labware.com void getRegs(ThreadContext*); 8311274Sshingarov@labware.com void setRegs(ThreadContext*) const; 8412031Sgabeblack@google.com const std::string 8512031Sgabeblack@google.com name() const 8612031Sgabeblack@google.com { 8712031Sgabeblack@google.com return gdb->name() + ".AArch32GdbRegCache"; 8812031Sgabeblack@google.com } 8911274Sshingarov@labware.com }; 9011274Sshingarov@labware.com 9111274Sshingarov@labware.com class AArch64GdbRegCache : public BaseGdbRegCache 9211274Sshingarov@labware.com { 9311274Sshingarov@labware.com using BaseGdbRegCache::BaseGdbRegCache; 9411274Sshingarov@labware.com private: 9511274Sshingarov@labware.com struct { 9611274Sshingarov@labware.com uint64_t x[31]; 9711274Sshingarov@labware.com uint64_t spx; 9811274Sshingarov@labware.com uint64_t pc; 9913468Sciro.santilli@arm.com uint32_t cpsr; 10014238Sciro.santilli@arm.com VecElem v[NumVecV8ArchRegs * NumVecElemPerNeonVecReg]; 10113579Sciro.santilli@arm.com uint32_t fpsr; 10213579Sciro.santilli@arm.com uint32_t fpcr; 10313468Sciro.santilli@arm.com } M5_ATTR_PACKED r; 10411274Sshingarov@labware.com public: 10511274Sshingarov@labware.com char *data() const { return (char *)&r; } 10611274Sshingarov@labware.com size_t size() const { return sizeof(r); } 10711274Sshingarov@labware.com void getRegs(ThreadContext*); 10811274Sshingarov@labware.com void setRegs(ThreadContext*) const; 10912031Sgabeblack@google.com const std::string 11012031Sgabeblack@google.com name() const 11112031Sgabeblack@google.com { 11212031Sgabeblack@google.com return gdb->name() + ".AArch64GdbRegCache"; 11312031Sgabeblack@google.com } 11411274Sshingarov@labware.com }; 1156019Shines@cs.fsu.edu 11612031Sgabeblack@google.com AArch32GdbRegCache regCache32; 11712031Sgabeblack@google.com AArch64GdbRegCache regCache64; 11812031Sgabeblack@google.com 11910601Sgabeblack@google.com public: 12012449Sgabeblack@google.com RemoteGDB(System *_system, ThreadContext *tc, int _port); 12111274Sshingarov@labware.com BaseGdbRegCache *gdbRegs(); 12213579Sciro.santilli@arm.com std::vector<std::string> 12313579Sciro.santilli@arm.com availableFeatures() const 12413579Sciro.santilli@arm.com { 12513579Sciro.santilli@arm.com return {"qXfer:features:read+"}; 12613579Sciro.santilli@arm.com }; 12713579Sciro.santilli@arm.com bool getXferFeaturesRead(const std::string &annex, std::string &output); 1287752SWilliam.Wang@arm.com}; 1297752SWilliam.Wang@arm.com} // namespace ArmISA 1306019Shines@cs.fsu.edu 1316019Shines@cs.fsu.edu#endif /* __ARCH_ARM_REMOTE_GDB_H__ */ 132