Boris Shingarov has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/47719 )

Change subject: base: Dump page table over RSP
......................................................................

base: Dump page table over RSP

Add a non-standard extension to the RSP protocol: the "." command
requests a dump of the simulated page table.
The dump consists of concatenated records, one record per page table
entry.  Each record contains the entry's "virtual" value written as
hex, followed by a colon (:), followed by the entry's "physical" value
written as hex, followed by a semicolon (;).

At the time of writing, one practical use of this feature (in
combination with the "shared_backstore" parameter) is extremely fast
Miranda-Ingalls simulation of JIT compilers.

Change-Id: I333ed11d4ce671251d0b93cddae3bbcea44ea4ca
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
M src/mem/page_table.cc
M src/mem/page_table.hh
4 files changed, 27 insertions(+), 0 deletions(-)



diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index f2ecfcc..c3353b7 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -153,6 +153,7 @@
 #include "mem/port.hh"
 #include "mem/port_proxy.hh"
 #include "sim/full_system.hh"
+#include "sim/process.hh"
 #include "sim/system.hh"

 namespace gem5
@@ -872,6 +873,8 @@
     { 'z', { "KGDB_CLR_HW_BKPT", &BaseRemoteGDB::cmdClrHwBkpt } },
     // insert breakpoint or watchpoint
     { 'Z', { "KGDB_SET_HW_BKPT", &BaseRemoteGDB::cmdSetHwBkpt } },
+    // non-standard RSP extension: dump page table
+    { '.', { "GET_PAGE_TABLE", &BaseRemoteGDB::cmdDumpPageTable } },
 };

 bool
@@ -1219,6 +1222,13 @@
 }

 bool
+BaseRemoteGDB::cmdDumpPageTable(GdbCommand::Context &ctx)
+{
+    send(tc->getProcessPtr()->pTable->externalize().c_str());
+    return true;
+}
+
+bool
 BaseRemoteGDB::cmdAsyncStep(GdbCommand::Context &ctx)
 {
     const char *p = ctx.data;
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index eb0661d..1089607 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -336,6 +336,7 @@
     bool cmdAsyncStep(GdbCommand::Context &ctx);
     bool cmdClrHwBkpt(GdbCommand::Context &ctx);
     bool cmdSetHwBkpt(GdbCommand::Context &ctx);
+    bool cmdDumpPageTable(GdbCommand::Context &ctx);

     struct QuerySetCommand
     {
diff --git a/src/mem/page_table.cc b/src/mem/page_table.cc
index a311a0a..6e27c30 100644
--- a/src/mem/page_table.cc
+++ b/src/mem/page_table.cc
@@ -206,4 +206,14 @@
     }
 }

+const std::string
+EmulationPageTable::externalize() const
+{
+    std::stringstream ss;
+ for (PTable::const_iterator it=pTable.begin(); it != pTable.end(); ++it) {
+        ss << std::hex << it->first << ":" << it->second.paddr << ";";
+    }
+    return ss.str();
+}
+
 } // namespace gem5
diff --git a/src/mem/page_table.hh b/src/mem/page_table.hh
index 900d446..c115a41 100644
--- a/src/mem/page_table.hh
+++ b/src/mem/page_table.hh
@@ -162,6 +162,12 @@
      */
     Fault translate(const RequestPtr &req);

+    /**
+ * Dump all items in the pTable, to a concatenation of strings of the form
+     *    Addr:Entry;
+     */
+    const std::string externalize() const;
+
     void getMappings(std::vector<std::pair<Addr, Addr>> *addr_mappings);

     void serialize(CheckpointOut &cp) const override;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/47719
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I333ed11d4ce671251d0b93cddae3bbcea44ea4ca
Gerrit-Change-Number: 47719
Gerrit-PatchSet: 1
Gerrit-Owner: Boris Shingarov <shinga...@labware.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to