Juan Manuel Cebrián González has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/28052 )

Change subject: arch-x86,cpu-o3: Replace M5_UNREACHABLE definition for X86.
......................................................................

arch-x86,cpu-o3: Replace M5_UNREACHABLE definition for X86.

Now it generates an unknown instruction instead of an exception.
This exception was not handled by the simulator and crashes it.
This situation is triggered when running deep into a mis-speculated data path when the simulator tries to decode random data from memory. By generating this instruction we give time to the simulator to squash the pipeline when it realizes the wrong data path.

Change-Id: Ie552cfc6ca90e4319e7d17553086e6efae989905
---
M src/arch/isa_parser.py
M src/base/compiler.hh
2 files changed, 7 insertions(+), 2 deletions(-)



diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py
index 7f09b16..f5662dd 100755
--- a/src/arch/isa_parser.py
+++ b/src/arch/isa_parser.py
@@ -2314,8 +2314,12 @@
         codeObj = t[3]
         # just wrap the decoding code from the block as a case in the
         # outer switch statement.
-        codeObj.wrap_decode_block('\n%s\n' % ''.join(case_list),
-                                  'M5_UNREACHABLE;\n')
+        if (self.isa_name == "X86ISA"):
+            codeObj.wrap_decode_block('\n%s\n' % ''.join(case_list),
+                                      'M5_X86_UNREACHABLE;\n')
+        else:
+            codeObj.wrap_decode_block('\n%s\n' % ''.join(case_list),
+                                      'M5_UNREACHABLE;\n')
         codeObj.has_decode_default = (case_list == ['default:'])
         t[0] = codeObj

diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index 957ef40..b08f4b0 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -56,6 +56,7 @@
 #  define M5_DEPRECATED __attribute__((deprecated))
 #  define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG)))
 #  define M5_UNREACHABLE __builtin_unreachable()
+#  define M5_X86_UNREACHABLE return new Unknown(machInst)
 #  define M5_PUBLIC __attribute__ ((visibility ("default")))
 #  define M5_LOCAL __attribute__ ((visibility ("hidden")))
 #endif

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

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ie552cfc6ca90e4319e7d17553086e6efae989905
Gerrit-Change-Number: 28052
Gerrit-PatchSet: 1
Gerrit-Owner: Juan Manuel Cebrián González <jm.cebriangonza...@gmail.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