Boris Shingarov has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40888 )

Change subject: arch-power: Fix disassembly for branch instructions
......................................................................

arch-power: Fix disassembly for branch instructions

This fixes disassembly generated for branch instructions
based on the AA and LK bits which determine how the target
address is calculated and whether a return address needs
to be set implicitly or not.

Change-Id: I1acba72c360a1fcb4691de17fbae1a012a752dbe
Signed-off-by: Sandipan Das <sandi...@linux.ibm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40888
Reviewed-by: Boris Shingarov <shinga...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/power/insts/branch.cc
1 file changed, 30 insertions(+), 5 deletions(-)

Approvals:
  Boris Shingarov: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/power/insts/branch.cc b/src/arch/power/insts/branch.cc
index 1077f33..1789734 100644
--- a/src/arch/power/insts/branch.cc
+++ b/src/arch/power/insts/branch.cc
@@ -67,7 +67,16 @@
     std::stringstream ss;
     Addr target;

-    ccprintf(ss, "%-10s ", mnemonic);
+    // Generate correct mnemonic
+    std::string myMnemonic(mnemonic);
+    std::string suffix;
+
+    // Additional characters depending on isa bits being set
+    if (lk)
+        suffix += "l";
+    if (aa)
+        suffix += "a";
+    ccprintf(ss, "%-10s ", myMnemonic + suffix);

     if (aa)
         target = li;
@@ -102,10 +111,19 @@
     std::stringstream ss;
     Addr target;

-    ccprintf(ss, "%-10s ", mnemonic);
+    // Generate the correct mnemonic
+    std::string myMnemonic(mnemonic);
+    std::string suffix;
+
+    // Additional characters depending on isa bits being set
+    if (lk)
+        suffix += "l";
+    if (aa)
+        suffix += "a";
+    ccprintf(ss, "%-10s ", myMnemonic + suffix);

     // Print BI and BO fields
-    ss << bi << ", " << bo << ", ";
+    ss << (int) bi << ", " << (int) bo << ", ";

     if (aa)
         target = bd;
@@ -136,10 +154,17 @@
 {
     std::stringstream ss;

-    ccprintf(ss, "%-10s ", mnemonic);
+    // Generate the correct mnemonic
+    std::string myMnemonic(mnemonic);
+    std::string suffix;
+
+    // Additional characters depending on isa bits being set
+    if (lk)
+        suffix += "l";
+    ccprintf(ss, "%-10s ", myMnemonic + suffix);

     // Print the BI and BO fields
-    ss << bi << ", " << bo;
+    ss << (int) bi << ", " << (int) bo;

     return ss.str();
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40888
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: I1acba72c360a1fcb4691de17fbae1a012a752dbe
Gerrit-Change-Number: 40888
Gerrit-PatchSet: 6
Gerrit-Owner: Sandipan Das <sandi...@linux.ibm.com>
Gerrit-Reviewer: Boris Shingarov <shinga...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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