x86: Use operand size 4 when it would be 2 for cmpxchg8b.
authorGabe Black <gabeblack@google.com>
Wed, 13 Dec 2017 09:03:00 +0000 (01:03 -0800)
committerGabe Black <gabeblack@google.com>
Thu, 14 Dec 2017 00:25:21 +0000 (00:25 +0000)
This means the instruction is treated as cmpxchg8b when the effective
operand size is 16 bits.

Change-Id: I4d9bb295f96097e1746a9bbccb2c579d14738fab
Reviewed-on: https://gem5-review.googlesource.com/6603
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/arch/x86/isa/insts/general_purpose/semaphores.py
src/arch/x86/isa/microasm.isa

index 9f751b3aef3da4f7b955c71a68fb544a1448ab42..bb46c42f2bfd6af9c0c1e028389691d356d1fc5a 100644 (file)
@@ -132,6 +132,7 @@ def macroop XADD_R_R {
 # of dataSize.
 cmpxchg8bCode = '''
 def macroop CMPXCHG8B_%(suffix)s {
+    .adjust_env clampOsz
     %(rdip)s
     lea t1, seg, %(sib)s, disp, dataSize=asz
     ldsplit%(l)s (t2, t3), seg, [1, t0, t1], disp=0
index 3ceaf9b28dd90bc1d0ee30c05afa037c3a6aaecf..2ee27502c03c9b88d686958dffd833e7d7cbbe90 100644 (file)
@@ -180,6 +180,11 @@ let {{
         env.dataSize = 4;
     '''
 
+    assembler.symbols["clampOsz"] = '''
+    if (env.dataSize == 2)
+        env.dataSize = 4;
+    '''
+
     def trimImm(width):
         return "adjustedImm = adjustedImm & mask(%s);" % width