changeset b3585da1f970 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b3585da1f970
description:
        X86: Make sure instruction flags are set properly even on 32 bit 
machines.

        The way flag bits were being set for microops in x86 ended up implicitly
        calling the bitset constructor which was truncating flags beyond the 
width of
        an unsigned long. This change sets the bits in chunks which are always 
small
        enough to avoid being truncated. On 64 bit machines this should reduce 
to be
        the same as before, and on 32 bit machines it should work properly and 
not be
        unreasonably inefficient.

diffstat:

 src/arch/x86/insts/microop.hh |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r d04ae08781e2 -r b3585da1f970 src/arch/x86/insts/microop.hh
--- a/src/arch/x86/insts/microop.hh     Mon Sep 05 02:48:57 2011 -0700
+++ b/src/arch/x86/insts/microop.hh     Mon Sep 05 18:36:26 2011 -0700
@@ -100,7 +100,15 @@
             X86ISA::X86StaticInst(mnem, _machInst, __opClass),
             instMnem(_instMnem)
         {
-            flags |= setFlags;
+            const int ChunkSize = sizeof(unsigned long);
+            const int Chunks = sizeof(setFlags) / ChunkSize;
+
+            // Since the bitset constructor can only handle unsigned long
+            // sized chunks, feed it those one at a time while oring them in.
+            for (int i = 0; i < Chunks; i++) {
+                unsigned shift = i * ChunkSize * 8;
+                flags |= (std::bitset<NumFlags>(setFlags >> shift) << shift);
+            }
         }
 
         std::string generateDisassembly(Addr pc,
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to