Yu-hsin Wang has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/43104 )

Change subject: misc: Add a copied symbol table for the kernel on physical address
......................................................................

misc: Add a copied symbol table for the kernel on physical address

In fs simulation, the kernel is loaded to physical address first and
then it would relocate itself to virtual address. The address which
using by kernel symbol table is virtual address. To debug the process
before kernel relocated to virutal memory, we need another copy of
symbol table for physical address.

Change-Id: I38107ff94b301df1a5170dd98774df88cfb02298
---
M src/base/loader/symtab.hh
M src/sim/kernel_workload.cc
2 files changed, 18 insertions(+), 0 deletions(-)



diff --git a/src/base/loader/symtab.hh b/src/base/loader/symtab.hh
index 5610544..a74bb76 100644
--- a/src/base/loader/symtab.hh
+++ b/src/base/loader/symtab.hh
@@ -154,6 +154,17 @@
     }

     SymbolTablePtr
+    rename(std::function<void(std::string&)> func) const
+    {
+        SymTabOp op = [func](SymbolTable &symtab, const Symbol &symbol) {
+            Symbol sym = symbol;
+            func(sym.name);
+            symtab.insert(sym);
+        };
+        return operate(op);
+    }
+
+    SymbolTablePtr
     globals() const
     {
         return filterByBinding(Symbol::Binding::Global);
diff --git a/src/sim/kernel_workload.cc b/src/sim/kernel_workload.cc
index 434e317..1b9bbfa 100644
--- a/src/sim/kernel_workload.cc
+++ b/src/sim/kernel_workload.cc
@@ -61,6 +61,13 @@
         });

         kernelSymtab = kernelObj->symtab();
+        auto relocateKernelSymtab = kernelSymtab.mask(_loadAddrMask)
+            ->offset(_loadAddrOffset)
+            ->rename([](std::string &name) {
+              name = "__gem5_relocate__" + name;
+            });
+
+        Loader::debugSymbolTable.insert(*relocateKernelSymtab);
         Loader::debugSymbolTable.insert(kernelSymtab);
     }


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/43104
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: I38107ff94b301df1a5170dd98774df88cfb02298
Gerrit-Change-Number: 43104
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang <yuhsi...@google.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