Eduardo José Gómez Hernández has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/44166 )
Change subject: arch-x86: Fixed locked cmpxchg8b allows reordering
......................................................................
arch-x86: Fixed locked cmpxchg8b allows reordering
Locked versions of cmpxcgh8b (and cmpxcgh16b) should
be guarded by mfences to prevent reordering from
surrounding memory instructions.
Change-Id: I4a04bb871b4f9a38efd78df194b43f785d5d2236
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44166
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/x86/isa/insts/general_purpose/semaphores.py
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/x86/isa/insts/general_purpose/semaphores.py
b/src/arch/x86/isa/insts/general_purpose/semaphores.py
index de7c6ef..aae67fa 100644
--- a/src/arch/x86/isa/insts/general_purpose/semaphores.py
+++ b/src/arch/x86/isa/insts/general_purpose/semaphores.py
@@ -132,6 +132,7 @@
def macroop CMPXCHG8B_%(suffix)s {
.adjust_env clampOsz
%(rdip)s
+ %(mfence)s
lea t1, seg, %(sib)s, disp, dataSize=asz
ldsplit%(l)s (t2, t3), seg, [1, t0, t1], disp=0
@@ -150,20 +151,25 @@
# Write to memory
stsplit%(ul)s (t2, t3), seg, [1, t0, t1], disp=0
+ %(mfence)s
};
'''
microcode += cmpxchg8bCode % {"rdip": "", "sib": "sib",
"l": "", "ul": "",
+ "mfence": "",
"suffix": "M"}
microcode += cmpxchg8bCode % {"rdip": "rdip t7", "sib": "riprel",
"l": "", "ul": "",
+ "mfence": "",
"suffix": "P"}
microcode += cmpxchg8bCode % {"rdip": "", "sib": "sib",
"l": "l", "ul": "ul",
+ "mfence": "mfence",
"suffix": "LOCKED_M"}
microcode += cmpxchg8bCode % {"rdip": "rdip t7", "sib": "riprel",
"l": "l", "ul": "ul",
+ "mfence": "mfence",
"suffix": "LOCKED_P"}
#let {{
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44166
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: I4a04bb871b4f9a38efd78df194b43f785d5d2236
Gerrit-Change-Number: 44166
Gerrit-PatchSet: 3
Gerrit-Owner: Eduardo José Gómez Hernández <eduardojose.go...@um.es>
Gerrit-Reviewer: Eduardo José Gómez Hernández <eduardojose.go...@um.es>
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