remote_gdb.hh revision 10804:df2aa91dba5b
13536Sgblack@eecs.umich.edu/*
23536Sgblack@eecs.umich.edu * Copyright 2014 Google, Inc.
33536Sgblack@eecs.umich.edu * Copyright (c) 2013 ARM Limited
43536Sgblack@eecs.umich.edu * All rights reserved
53536Sgblack@eecs.umich.edu *
63536Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall
73536Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual
83536Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating
93536Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software
103536Sgblack@eecs.umich.edu * licensed hereunder.  You may use the software subject to the license
113536Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated
123536Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software,
133536Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form.
143536Sgblack@eecs.umich.edu *
153536Sgblack@eecs.umich.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan
163536Sgblack@eecs.umich.edu * Copyright (c) 2007-2008 The Florida State University
173536Sgblack@eecs.umich.edu * All rights reserved.
183536Sgblack@eecs.umich.edu *
193536Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
203536Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
213536Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
223536Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
233536Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
243536Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
253536Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
263536Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
273536Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
283536Sgblack@eecs.umich.edu * this software without specific prior written permission.
293536Sgblack@eecs.umich.edu *
303536Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
313536Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
323536Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
333536Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
343536Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
353536Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
363536Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
373536Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
383536Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
393536Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
403536Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
413536Sgblack@eecs.umich.edu *
423536Sgblack@eecs.umich.edu * Authors: Nathan Binkert
433536Sgblack@eecs.umich.edu *          Stephen Hines
443536Sgblack@eecs.umich.edu */
453536Sgblack@eecs.umich.edu
463536Sgblack@eecs.umich.edu#ifndef __ARCH_ARM_REMOTE_GDB_HH__
475569Snate@binkert.org#define __ARCH_ARM_REMOTE_GDB_HH__
485569Snate@binkert.org
495569Snate@binkert.org#include <algorithm>
503536Sgblack@eecs.umich.edu
515569Snate@binkert.org#include "base/remote_gdb.hh"
525569Snate@binkert.org
535569Snate@binkert.orgclass System;
543536Sgblack@eecs.umich.educlass ThreadContext;
555569Snate@binkert.org
565569Snate@binkert.orgnamespace ArmISA
575569Snate@binkert.org{
583536Sgblack@eecs.umich.edu
595569Snate@binkert.org// AArch32 registers with vfpv3/neon
605569Snate@binkert.orgenum {
613536Sgblack@eecs.umich.edu    GDB32_R0 = 0,
625569Snate@binkert.org    GDB32_CPSR = 16,
635569Snate@binkert.org    GDB32_F0 = 17,
645569Snate@binkert.org    GDB32_FPSCR = 81,
653536Sgblack@eecs.umich.edu    GDB32_NUMREGS = 82
665569Snate@binkert.org};
675569Snate@binkert.org
685569Snate@binkert.org// AArch64 registers
693536Sgblack@eecs.umich.eduenum {
705569Snate@binkert.org    GDB64_X0 = 0,
713536Sgblack@eecs.umich.edu    GDB64_SPX = 31,
725569Snate@binkert.org    GDB64_PC = 32,
73    GDB64_CPSR = 33,
74    GDB64_V0 = 34,
75    GDB64_V0_32 = 2 * GDB64_V0,
76    GDB64_NUMREGS = 98
77};
78
79const int GDB_REG_BYTES M5_VAR_USED =
80    std::max(GDB64_NUMREGS * sizeof(uint64_t),
81             GDB32_NUMREGS * sizeof(uint32_t));
82
83class RemoteGDB : public BaseRemoteGDB
84{
85  protected:
86    bool acc(Addr addr, size_t len);
87    bool write(Addr addr, size_t size, const char *data);
88
89    void getregs();
90    void setregs();
91
92  public:
93    RemoteGDB(System *_system, ThreadContext *tc);
94};
95} // namespace ArmISA
96
97#endif /* __ARCH_ARM_REMOTE_GDB_H__ */
98