From: Gabe Black Date: Sun, 19 Apr 2009 11:56:40 +0000 (-0700) Subject: X86: Implement a locking version of CMPXCHG. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43f58927d693fbe18a7db2e20f540da13bc15cd3;p=gem5.git X86: Implement a locking version of CMPXCHG. --- diff --git a/src/arch/x86/isa/insts/general_purpose/semaphores.py b/src/arch/x86/isa/insts/general_purpose/semaphores.py index f23241863..a34e2a3c7 100644 --- a/src/arch/x86/isa/insts/general_purpose/semaphores.py +++ b/src/arch/x86/isa/insts/general_purpose/semaphores.py @@ -79,6 +79,25 @@ def macroop CMPXCHG_P_R { mov rax, rax, t1, flags=(nCZF,) }; +def macroop CMPXCHG_LOCKED_M_R { + ldstl t1, seg, sib, disp + sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF) + + mov t1, t1, reg, flags=(CZF,) + stul t1, seg, sib, disp + mov rax, rax, t1, flags=(nCZF,) +}; + +def macroop CMPXCHG_LOCKED_P_R { + rdip t7 + ldstl t1, seg, riprel, disp + sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF) + + mov t1, t1, reg, flags=(CZF,) + stul t1, seg, riprel, disp + mov rax, rax, t1, flags=(nCZF,) +}; + def macroop XADD_M_R { ldst t1, seg, sib, disp add t2, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)