diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index f39ffb42c6f..341123f7488 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -44,6 +44,7 @@ C_SRCS = \ threadpool.c \ time.c \ unix/cdrom.c \ + unix/cmpxchg64.c \ unix/debug.c \ unix/env.c \ unix/file.c \ diff --git a/dlls/ntdll/unix/cmpxchg64.c b/dlls/ntdll/unix/cmpxchg64.c new file mode 100644 index 00000000000..032e32bb4c2 --- /dev/null +++ b/dlls/ntdll/unix/cmpxchg64.c @@ -0,0 +1,64 @@ +/* + * Large integer functions + * + * Copyright 2000 Alexandre Julliard + * Copyright 2003 Thomas Mertes + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" +#include "wine/asm.h" + + +#ifndef _WIN64 + +/************************************************************************* + * RtlInterlockedCompareExchange64 (NTDLL.@) + */ +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +__ASM_STDCALL_FUNC(RtlInterlockedCompareExchange64, 20, + "push %ebx\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + __ASM_CFI(".cfi_rel_offset %ebx,0\n\t") + "push %esi\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + __ASM_CFI(".cfi_rel_offset %esi,0\n\t") + "movl 12(%esp),%esi\n\t" + "movl 16(%esp),%ebx\n\t" + "movl 20(%esp),%ecx\n\t" + "movl 24(%esp),%eax\n\t" + "movl 28(%esp),%edx\n\t" + "lock; cmpxchg8b (%esi)\n\t" + "pop %esi\n\t" + __ASM_CFI(".cfi_same_value %esi\n\t") + __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") + "pop %ebx\n\t" + __ASM_CFI(".cfi_same_value %ebx\n\t") + __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") + "ret $20") +#endif + +#endif /* _WIN64 */ +