From 349cad77032c8a3c7f966e77e381517f162c9abd Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Tue, 7 Jul 2020 15:34:56 -0400 Subject: [PATCH] arch-power: Implement GDB XML target description for PowerPC Change-Id: I2610626a7e1464316ebaa770291d4bdcb59e8856 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31114 Reviewed-by: Ciro Santilli Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Tested-by: kokoro --- ext/gdb-xml/power.xml | 92 ++++++++++++++++++++++++++++++++++++ src/arch/power/SConscript | 3 ++ src/arch/power/remote_gdb.cc | 17 +++++++ src/arch/power/remote_gdb.hh | 6 +++ 4 files changed, 118 insertions(+) create mode 100644 ext/gdb-xml/power.xml diff --git a/ext/gdb-xml/power.xml b/ext/gdb-xml/power.xml new file mode 100644 index 000000000..da5a07ca9 --- /dev/null +++ b/ext/gdb-xml/power.xml @@ -0,0 +1,92 @@ + + + + + + powerpc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/arch/power/SConscript b/src/arch/power/SConscript index a91b5d985..1187acf3d 100644 --- a/src/arch/power/SConscript +++ b/src/arch/power/SConscript @@ -1,6 +1,7 @@ # -*- mode:python -*- # Copyright (c) 2009 The University of Edinburgh +# Copyright (c) 2020 LabWare # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -56,3 +57,5 @@ if env['TARGET_ISA'] == 'power': DebugFlag('Power') ISADesc('isa/main.isa') + + GdbXml('power.xml', 'gdb_xml_power') diff --git a/src/arch/power/remote_gdb.cc b/src/arch/power/remote_gdb.cc index ccee0b132..661c4310e 100644 --- a/src/arch/power/remote_gdb.cc +++ b/src/arch/power/remote_gdb.cc @@ -136,6 +136,7 @@ #include +#include "blobs/gdb_xml_power.hh" #include "cpu/thread_state.hh" #include "debug/GDBAcc.hh" #include "debug/GDBMisc.hh" @@ -213,3 +214,19 @@ RemoteGDB::gdbRegs() return ®Cache; } +bool +RemoteGDB::getXferFeaturesRead(const std::string &annex, std::string &output) +{ +#define GDB_XML(x, s) \ + { x, std::string(reinterpret_cast(Blobs::s), \ + Blobs::s ## _len) } + static const std::map annexMap { + GDB_XML("target.xml", gdb_xml_power), + }; +#undef GDB_XML + auto it = annexMap.find(annex); + if (it == annexMap.end()) + return false; + output = it->second; + return true; +} diff --git a/src/arch/power/remote_gdb.hh b/src/arch/power/remote_gdb.hh index 1b673bbed..3bb726e52 100644 --- a/src/arch/power/remote_gdb.hh +++ b/src/arch/power/remote_gdb.hh @@ -76,6 +76,12 @@ class RemoteGDB : public BaseRemoteGDB public: RemoteGDB(System *_system, ThreadContext *tc, int _port); BaseGdbRegCache *gdbRegs(); + std::vector + availableFeatures() const + { + return {"qXfer:features:read+"}; + }; + bool getXferFeaturesRead(const std::string &annex, std::string &output); }; } // namespace PowerISA -- 2.30.2