From 7fc2d86bb20a9762bdf0a86ff96017ec8cd4601c Mon Sep 17 00:00:00 2001 From: sergei Date: Wed, 16 Mar 2011 06:28:47 +0000 Subject: [PATCH] + InterlockedCompareExchange128, Linux implementation. git-svn-id: trunk@17140 - --- rtl/x86_64/cpu.pp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rtl/x86_64/cpu.pp b/rtl/x86_64/cpu.pp index bdf4439632..806db981d6 100644 --- a/rtl/x86_64/cpu.pp +++ b/rtl/x86_64/cpu.pp @@ -50,6 +50,7 @@ unit cpu; r8 ... NewValue r9 ... Comperand } + {$ifdef win64} asm pushq %rbx @@ -81,7 +82,30 @@ unit cpu; popq %rbx end; + {$else win64} + { + linux: + rdi ... target + [rsi:rdx] ... NewValue + [rcx:r8] ... Comperand + [rdx:rax] ... result + } + asm + pushq %rbx + movq %rsi,%rbx // new value low + movq %rcx,%rax // comperand low + movq %rdx,%rcx // new value high + movq %r8,%rdx // comperand high + {$ifdef oldbinutils} + .byte 0xF0,0x48,0x0F,0xC7,0x0F + {$else} + lock cmpxchg16b (%rdi) + {$endif} + + popq %rbx + end; + {$endif win64} procedure SetupSupport; var